I have a problem with the stock errors on the shopping cart. If a product with an attribute is in the cart is either out of stock or over my stock count, the product is marked with *** correctly. However an item without any attributes doesn't generate an error. I think there is a problem with the code below:
Code:
// Added to allow individual stock of different attributes
unset($attributes);
if(is_array($products[$i]['attributes'])){
$attributes = $products[$i]['attributes'];
} else {
$attributes = '';
}
$stock_check = zen_check_stock($products[$i]['id'], $products[$i]['quantity'],$attributes);
$flagStockCheck = NULL;
if (zen_not_null($stock_check))
{
$flagAnyOutOfStock = true;
$flagStockCheck = $stock_check;
$stockAvailable = zen_get_products_stock($products[$i]['id'], $attributes);
}
}
// end stock by attributes
} //end foreach [attributes]
/*
if (STOCK_CHECK == 'true') {
$flagStockCheck = zen_check_stock($products[$i]['id'], $products[$i]['quantity']);
if ($flagStockCheck == true) {
$flagAnyOutOfStock = true;
}
}
*/
If I un-comment out the original code, the error problem flips. It will mark the product without the attribute, but in return the product with the attribute is not longer marked. Is there a problem that any can see with the code?
Bookmarks