// add check stock value for color list if needed

This commit is contained in:
Rémi Gaillard
2013-10-11 14:11:12 +02:00
parent 809eac6308
commit 1316bd7e1f
4 changed files with 64 additions and 6 deletions
+22 -1
View File
@@ -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;
}