// Manage SQL upgrade for stock management + bug fix

This commit is contained in:
dSevere
2011-12-13 11:09:37 +00:00
parent bbf33b9799
commit cd44e07056
6 changed files with 36 additions and 36 deletions
+2 -5
View File
@@ -2,7 +2,7 @@
function set_product_suppliers()
{
//Get all products with positive quantity
$resource = Db::getInstance()->query('
$resource = Db::getInstance(_PS_USE_SQL_SLAVE_)->query('
SELECT id_supplier, id_product, supplier_reference, wholesale_price
FROM `'._DB_PREFIX_.'product`
WHERE `id_supplier` > 0
@@ -19,7 +19,7 @@ function set_product_suppliers()
');
//Try to get product attribues
$attributes = Db::getInstance()->ExecuteS('
$attributes = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
SELECT id_product_attribute, supplier_reference, wholesale_price
FROM `'._DB_PREFIX_.'product_attribute`
WHERE `id_product` = '.(int)$row['id_product']
@@ -28,9 +28,6 @@ function set_product_suppliers()
//Add each attribute to stock_available
foreach ($attributes as $attribute)
{
// add to global quantity
$quantity += $attribute['quantity'];
// set supplier for attribute
Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'product_supplier`