// Fixed exceptions when saving products

This commit is contained in:
bMancone
2012-04-17 15:56:04 +00:00
parent 622b14e424
commit 5e55b74e15
5 changed files with 10 additions and 10 deletions
+5 -5
View File
@@ -1101,7 +1101,7 @@ class ProductCore extends ObjectModel
$this->addSupplierReference($supplier_reference, $id_product_attribute);
$result = ObjectModel::updateMultishopTable('Combination', array(
'wholesale_price' => (float)$wholesale_price,
), 'id_product_attribute = '.(int)$id_product_attribute);
), 'a.id_product_attribute = '.(int)$id_product_attribute);
if (!$id_product_attribute || !$result)
return false;
@@ -1144,11 +1144,11 @@ class ProductCore extends ObjectModel
{
$result = ObjectModel::updateMultishopTable('Combination', array(
'default_on' => 1
), '`id_product` = '.(int)$this->id.' AND `id_product_attribute` = '.(int)$id_product_attribute);
), '`id_product` = '.(int)$this->id.' AND a.`id_product_attribute` = '.(int)$id_product_attribute);
$result &= ObjectModel::updateMultishopTable('product', array(
'cache_default_attribute' => (int)$id_product_attribute,
), '`id_product` = '.(int)$this->id);
), '`a.id_product` = '.(int)$this->id);
return $result;
}
@@ -2762,7 +2762,7 @@ class ProductCore extends ObjectModel
if (!$mini)
return false;
if (!ObjectModel::updateMultishopTable('Combination', array('default_on' => 1), 'id_product_attribute = '.(int)$mini['id_attr']))
if (!ObjectModel::updateMultishopTable('Combination', array('default_on' => 1), 'a.id_product_attribute = '.(int)$mini['id_attr']))
return false;
return true;
}
@@ -3821,7 +3821,7 @@ class ProductCore extends ObjectModel
return false;
}
if ($has_required_fields && !ObjectModel::updateMultishopTable('product', array('customizable' => 2), 'id_product = '.(int)$this->id))
if ($has_required_fields && !ObjectModel::updateMultishopTable('product', array('customizable' => 2), 'a.id_product = '.(int)$this->id))
return false;
if (!$this->_deleteOldLabels())
+1 -1
View File
@@ -574,7 +574,7 @@ class SearchCore
protected static function setProductsAsIndexed(&$products)
{
if (count($products))
ObjectModel::updateMultishopTable('Product', array('indexed' => 1), 'id_product IN ('.implode(',', $products).')');
ObjectModel::updateMultishopTable('Product', array('indexed' => 1), 'a.id_product IN ('.implode(',', $products).')');
}
/** $queryArray3 is automatically emptied in order to be reused immediatly */
+1 -1
View File
@@ -192,7 +192,7 @@ class TagCore extends ObjectModel
if (is_array($array))
{
$array = array_map('intval', $array);
$result &= ObjectModel::updateMultishopTable('Product', array('indexed' => 0), 'id_product IN ('.implode(',', $array).')');
$result &= ObjectModel::updateMultishopTable('Product', array('indexed' => 0), 'a.id_product IN ('.implode(',', $array).')');
$ids = array();
foreach ($array as $id_product)
$ids[] = '('.(int)$id_product.','.(int)$this->id.')';
@@ -246,7 +246,7 @@ class AdminPPreferencesControllerCore extends AdminController
if (Configuration::get('PS_ADVANCED_STOCK_MANAGEMENT') == 1 &&
(int)Tools::getValue('PS_ADVANCED_STOCK_MANAGEMENT') == 0)
{
ObjectModel::updateMultishopTable('Product', array('advanced_stock_management' => 0), '`advanced_stock_management` = 1');
ObjectModel::updateMultishopTable('Product', array('advanced_stock_management' => 0), 'a.`advanced_stock_management` = 1');
Db::getInstance()->execute(
'UPDATE `'._DB_PREFIX_.'stock_available`
@@ -2480,8 +2480,8 @@ class AdminProductsControllerCore extends AdminController
'wholesale_price' => (float)Tools::convertPrice($price, $id_currency)
);
$where = '
id_product = '.(int)$product->id.'
AND id_product_attribute = '.(int)$attribute['id_product_attribute'];
a.id_product = '.(int)$product->id.'
AND a.id_product_attribute = '.(int)$attribute['id_product_attribute'];
ObjectModel::updateMultishopTable('Combination', $data, $where);
}
else