[-] Core: fix cache product group reduction #PSCFV-4974

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@17883 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-10-16 17:48:30 +00:00
parent 0fd7eeaccc
commit ec82772928
3 changed files with 49 additions and 39 deletions
+3 -11
View File
@@ -467,6 +467,7 @@ class ProductCore extends ObjectModel
else
StockAvailable::setProductOutOfStock((int)$this->id, 2);
$this->setGroupReduction();
Hook::exec('actionProductSave', array('id_product' => $this->id));
return true;
}
@@ -474,6 +475,7 @@ class ProductCore extends ObjectModel
public function update($null_values = false)
{
$return = parent::update($null_values);
$this->setGroupReduction();
Hook::exec('actionProductSave', array('id_product' => $this->id));
return $return;
}
@@ -803,8 +805,6 @@ class ProductCore extends ObjectModel
if (!$this->addToCategories($categories))
return false;
if (!$this->setGroupReduction())
return false;
SpecificPriceRule::applyAllRules(array((int)$this->id));
return true;
}
@@ -4522,15 +4522,7 @@ class ProductCore extends ObjectModel
*/
public function setGroupReduction()
{
$row = GroupReduction::getGroupByCategoryId($this->id_category_default);
if (!$row) // Remove
{
if (!GroupReduction::deleteProductReduction($this->id))
return false;
}
else if (!GroupReduction::setProductReduction($this->id, $row['id_group'], $this->id_category_default, (float)$row['reduction']))
return false;
return true;
return GroupReduction::setProductReduction($this->id, null, $this->id_category_default);
}
/**