Search the Community
Showing results for tags 'Warning line 324'.
-
PS version 1.4.9.0 Hi For a product with combimations, when all the combinations are out of stock I get the following Warning: Warning: Invalid argument supplied for foreach() in /home/my domain/public_html/controllers/ProductController.php on line 324 This is the code at line 324: foreach ($combinations as $id_product_attribute => $comb) { $attributeList = ''; foreach ($comb['attributes'] as $id_attribute) $attributeList .= '\''.(int)$id_attribute.'\','; $attributeList = rtrim($attributeList, ','); $combinations[$id_product_attribute]['list'] = $attributeList; } self::$smarty->assign(array( 'groups' => $groups, 'combinaisons' => $combinations, /* Kept for compatibility purpose only */ 'combinations' => $combinations, 'colors' => (count($colors) && $this->product->id_color_default) ? $colors : false, 'combinationImages' => $combinationImages)); When all combinations for the product are out of stock $combinations is Null, hence the warning. A solution might be to wrap the code above in an: ' if ($combinations) ' statement. Th only thing is that non of the code above would be executed. When $combination is Null the data is set as: groups = array(0) {} combinations = NULL colors = array(0) {} So should I just apply the ' if ($combinations) ' statement to the 'foreach block' or both the 'foreach block' and the $smarty->assign block ? Thanks Chris G