// MERGE product_multistore branch : product fields are now editable per shop
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@14682 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+9
-12
@@ -126,7 +126,7 @@ class PackCore extends Product
|
||||
if (!Pack::isFeatureActive())
|
||||
return array();
|
||||
|
||||
$sql = 'SELECT p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity, asso_shop_product.`id_category_default`
|
||||
$sql = 'SELECT p.*, product_shop.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity, product_shop.`id_category_default`
|
||||
FROM `'._DB_PREFIX_.'pack` a
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
@@ -136,16 +136,14 @@ class PackCore extends Product
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
|
||||
ON asso_shop_product.`id_category_default` = cl.`id_category`
|
||||
ON product_shop.`id_category_default` = cl.`id_category`
|
||||
AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)Context::getContext()->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE asso_shop_product.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
WHERE product_shop.`id_shop` = '.(int)Context::getContext()->shop->id.'
|
||||
AND a.`id_product_pack` = '.(int)$id_product;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
if (!$full)
|
||||
@@ -172,14 +170,13 @@ class PackCore extends Product
|
||||
return array();
|
||||
|
||||
$sql = '
|
||||
SELECT p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`
|
||||
SELECT p.*, product_shop.*, pl.*, i.`id_image`, il.`legend`, t.`rate`
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
'.Shop::addSqlAssociation('product', 'p').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (p.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)Context::getContext()->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||
AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
||||
@@ -202,7 +199,7 @@ class PackCore extends Product
|
||||
|
||||
public static function deleteItems($id_product)
|
||||
{
|
||||
return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 0 WHERE id_product = '.(int)$id_product.' LIMIT 1') &&
|
||||
return Db::getInstance()->update('product', array('cache_is_pack' => 0), 'id_product = '.(int)$id_product) &&
|
||||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'pack` WHERE `id_product_pack` = '.(int)$id_product) &&
|
||||
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', Pack::isCurrentlyUsed());
|
||||
}
|
||||
@@ -217,7 +214,7 @@ class PackCore extends Product
|
||||
*/
|
||||
public static function addItem($id_product, $id_item, $qty)
|
||||
{
|
||||
return Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'product SET cache_is_pack = 1 WHERE id_product = '.(int)$id_product.' LIMIT 1') &&
|
||||
return Db::getInstance()->update('product', array('cache_is_pack', 1), 'id_product = '.(int)$id_product) &&
|
||||
Db::getInstance()->insert('pack', array('id_product_pack' => (int)$id_product, 'id_product_item' => (int)$id_item, 'quantity' => (int)$qty)) &&
|
||||
Configuration::updateGlobalValue('PS_PACK_FEATURE_ACTIVE', '1');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user