
Originally Posted by
rhlee
Hi all,
I'm running Zen Cart 1.3.8a with the Product attributes with Stock, latest version. It seemed to be working.
However now, when I set a quantity for a single variant. It marks all of the variants as out of stock.
You guys experienced this before.
Thanks in advance.
Rich
I found the bugger.
products_with_attributes_stock.php line 234
Code:
for ($i = 0;$i < sizeof($arrNew);$i++) {
$strAttributes = implode(",", $arrNew[$i]);
$query = 'insert into `'.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'` (`products_id`,`stock_attributes`,`quantity`) values ('.$products_id.',"'.$strAttributes.'",'.$quantity.') ON DUPLICATE KEY UPDATE `stock_attributes` = "'.$strAttributes.'", `quantity` = '.$quantity;
$db->Execute($query);
}
should be
Code:
for ($i = 0;$i < sizeof($arrNew);$i++) {
sort($arrNew[$i])
$strAttributes = implode(",", $arrNew[$i]);
$query = 'insert into `'.TABLE_PRODUCTS_WITH_ATTRIBUTES_STOCK.'` (`products_id`,`stock_attributes`,`quantity`) values ('.$products_id.',"'.$strAttributes.'",'.$quantity.') ON DUPLICATE KEY UPDATE `stock_attributes` = "'.$strAttributes.'", `quantity` = '.$quantity;
$db->Execute($query);
}
Otherwise the attributes will display in the wrong order on the field