// add check stock value for color list if needed
This commit is contained in:
@@ -379,7 +379,28 @@ class StockAvailableCore extends ObjectModel
|
||||
if (!$result = parent::update($null_values))
|
||||
return false;
|
||||
|
||||
$result &= $this->postSave();
|
||||
$result &= $this->postSave();
|
||||
if (!Configuration::get('PS_DISP_UNAVAILABLE_ATTR'))
|
||||
{
|
||||
$combination = new Combination((int)$this->id_product_attribute);
|
||||
if ($colors = $combination->getColorsAttributes())
|
||||
{
|
||||
$product = new Product((int)$this->id_product);
|
||||
foreach ($colors as $color)
|
||||
{
|
||||
if ($product->isColorUnavailable((int)$color['id_attribute'], (int)$this->id_shop))
|
||||
{
|
||||
// Change template dir if called from the BackOffice
|
||||
$current_template_dir = Context::getContext()->smarty->getTemplateDir();
|
||||
Context::getContext()->smarty->setTemplateDir(_PS_THEME_DIR_.'tpl');
|
||||
Tools::clearCache(null, 'product-list-colors.tpl', Product::getColorsListCacheId((int)$product->id));
|
||||
Context::getContext()->smarty->setTemplateDir($current_template_dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user