`ps_stock_available` (`id_stock_available`, `id_product`, `id_product_attribute`, `id_shop`, `id_shop_group`, `quantity`, `depends_on_stock`, `out_of_stock`) VALUES
(53, 1, 1, 0, 1, 40, 0, 2),
(54, 1, 0, 0, 1, 71, 0, 0),
(55, 1, 2, 0, 1, 31, 0, 2),
(56, 1, 3, 0, 1, 0, 0, 0),
(57, 1, 4, 0, 1, 0, 0, 0),
(58, 1, 5, 0, 1, 0, 0, 0),
(59, 1, 6, 0, 1, 0, 0, 0),
(60, 2, 0, 0, 0, 14, 0, 0),
(61, 2, 0, 0, 1, 14, 0, 0),
(62, 7, 34, 0, 1, 777, 0, 2),
(63, 7, 35, 0, 1, 888, 0, 2),
(64, 6, 0, 0, 1, 14, 0, 0),
(65, 7, 0, 0, 1, 778, 0, 0);
mysql_query('UPDATE `'._DB_PREFIX_.'product_attribute` SET `quantity` = \''.$count.'\' , id_shop = 0 , id_shop_group = 1 WHERE `ean13` = \''.$code.'\' ');
mysql_query('UPDATE `'._DB_PREFIX_.'product` SET `quantity` = \''.$count.'\' WHERE `id_product` = \''.$row->id_product.'\' ');
$id_product_attribute = $row->id_product_attribute;
mysql_query('UPDATE `'._DB_PREFIX_.'stock_available` SET `quantity` = \''.$count.'\' , id_shop = 0 , id_shop_group = 1 WHERE `id_product_attribute` = \''.$id_product_attribute.'\' ');
我从XML更新我的库存,其中包括:ean13代码和产品数量。
但我注意到总量是错误的。
(62,7,34,0,1,777,0,2), (63,7,35,0,1,888,0,2) 总数量: (65,7,0,0,1,778,0,0); 它不应该是778但是= 777 + 888 = 1665
我应该如何编写SQL来更新它?计算具有相同ID的值,并使用该ID更新行,其中id_product_attribute = 0。