// Replace shop->sqlAsso(), shop->sqlLang() and shop->sqlRestriction() with shop->addSqlAssociation(), shop->addSqlRestrictionOnLang() and shop->addSqlRestriction()
This commit is contained in:
+3
-3
@@ -128,7 +128,7 @@ if (Tools::isSubmit('ajaxProductAccessories'))
|
|||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||||
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
|
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
|
||||||
'.Context::getContext()->shop->sqlLang('pl').'
|
'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').'
|
||||||
AND p.`id_product` != '.(int)(Tools::getValue('id_product')).'
|
AND p.`id_product` != '.(int)(Tools::getValue('id_product')).'
|
||||||
AND p.`id_product` NOT IN (
|
AND p.`id_product` NOT IN (
|
||||||
SELECT a.`id_product_2`
|
SELECT a.`id_product_2`
|
||||||
@@ -393,7 +393,7 @@ if (Tools::isSubmit('ajaxProductPackItems'))
|
|||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
NATURAL LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||||
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
|
WHERE pl.`id_lang` = '.(int)(Tools::getValue('id_lang')).'
|
||||||
'.Context::getContext()->shop->sqlLang('pl').'
|
'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').'
|
||||||
AND p.`id_product` NOT IN (SELECT DISTINCT id_product_pack FROM `'._DB_PREFIX_.'pack`)
|
AND p.`id_product` NOT IN (SELECT DISTINCT id_product_pack FROM `'._DB_PREFIX_.'pack`)
|
||||||
AND p.`id_product` != '.(int)(Tools::getValue('id_product')));
|
AND p.`id_product` != '.(int)(Tools::getValue('id_product')));
|
||||||
|
|
||||||
@@ -963,7 +963,7 @@ if (Tools::isSubmit('searchCategory'))
|
|||||||
$results = Db::getInstance()->executeS(
|
$results = Db::getInstance()->executeS(
|
||||||
'SELECT c.`id_category`, cl.`name`
|
'SELECT c.`id_category`, cl.`name`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.$context->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.$context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE cl.`id_lang` = '.(int)($context->language->id).' AND c.`level_depth` <> 0
|
WHERE cl.`id_lang` = '.(int)($context->language->id).' AND c.`level_depth` <> 0
|
||||||
AND cl.`name` LIKE \'%'.pSQL($q).'%\'
|
AND cl.`name` LIKE \'%'.pSQL($q).'%\'
|
||||||
GROUP BY c.id_category
|
GROUP BY c.id_category
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ $excludeVirtuals = (bool)Tools::getValue('excludeVirtuals', false);
|
|||||||
|
|
||||||
$sql = 'SELECT p.`id_product`, `reference`, pl.name
|
$sql = 'SELECT p.`id_product`, `reference`, pl.name
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)Context::getContext()->language->id.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = p.id_product AND pl.id_lang = '.(int)Context::getContext()->language->id.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
WHERE (pl.name LIKE \'%'.pSQL($query).'%\' OR p.reference LIKE \'%'.pSQL($query).'%\')'.
|
||||||
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
(!empty($excludeIds) ? ' AND p.id_product NOT IN ('.$excludeIds.') ' : ' ').
|
||||||
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '');
|
($excludeVirtuals ? 'AND p.id_product NOT IN (SELECT pd.id_product FROM `'._DB_PREFIX_.'product_download` pd WHERE (pd.id_product = p.id_product))' : '');
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ function getPath($urlBase, $id_category, $path = '', $highlight = '', $categoryT
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT c.id_category, cl.name, cl.link_rewrite
|
$sql = 'SELECT c.id_category, cl.name, cl.link_rewrite
|
||||||
FROM '._DB_PREFIX_.'category c
|
FROM '._DB_PREFIX_.'category c
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE c.nleft <= '.(int)$category['nleft'].'
|
WHERE c.nleft <= '.(int)$category['nleft'].'
|
||||||
AND c.nright >= '.(int)$category['nright'].'
|
AND c.nright >= '.(int)$category['nright'].'
|
||||||
AND cl.id_lang = '.(int)$context->language->id.
|
AND cl.id_lang = '.(int)$context->language->id.
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class AdminStockManagement extends AdminTab
|
|||||||
|
|
||||||
$this->_select = 'CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) AS employee, mrl.name AS reason, CONCAT(w.reference, " - ", w.name) AS warehouse';
|
$this->_select = 'CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) AS employee, mrl.name AS reason, CONCAT(w.reference, " - ", w.name) AS warehouse';
|
||||||
$this->_join = 'INNER JOIN '._DB_PREFIX_.'stock stock ON a.id_stock = stock.id_stock
|
$this->_join = 'INNER JOIN '._DB_PREFIX_.'stock stock ON a.id_stock = stock.id_stock
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (stock.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (stock.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (a.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$this->context->language->id.')
|
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (a.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$this->context->language->id.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)
|
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = stock.id_warehouse)
|
LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = stock.id_warehouse)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class AdminStockMvt extends AdminTab
|
|||||||
|
|
||||||
$this->_select = 'CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) AS employee, mrl.name AS reason, CONCAT(w.reference, " - ", w.name) AS warehouse';
|
$this->_select = 'CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) AS employee, mrl.name AS reason, CONCAT(w.reference, " - ", w.name) AS warehouse';
|
||||||
$this->_join = 'INNER JOIN '._DB_PREFIX_.'stock stock ON a.id_stock = stock.id_stock
|
$this->_join = 'INNER JOIN '._DB_PREFIX_.'stock stock ON a.id_stock = stock.id_stock
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (stock.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (stock.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (a.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$this->context->language->id.')
|
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (a.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$this->context->language->id.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)
|
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = a.id_employee)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = stock.id_warehouse)
|
LEFT JOIN `'._DB_PREFIX_.'warehouse` w ON (w.id_warehouse = stock.id_warehouse)
|
||||||
|
|||||||
Vendored
+14
-6
@@ -108,6 +108,8 @@
|
|||||||
'HelperForm' => '',
|
'HelperForm' => '',
|
||||||
'HelperListCore' => 'classes/HelperList.php',
|
'HelperListCore' => 'classes/HelperList.php',
|
||||||
'HelperList' => '',
|
'HelperList' => '',
|
||||||
|
'HelperOptionsCore' => 'classes/HelperOptions.php',
|
||||||
|
'HelperOptions' => '',
|
||||||
'HookCore' => 'classes/Hook.php',
|
'HookCore' => 'classes/Hook.php',
|
||||||
'Hook' => 'override/classes/Hook.php',
|
'Hook' => 'override/classes/Hook.php',
|
||||||
'ImageCore' => 'classes/Image.php',
|
'ImageCore' => 'classes/Image.php',
|
||||||
@@ -206,12 +208,6 @@
|
|||||||
'SpecificPrice' => 'override/classes/SpecificPrice.php',
|
'SpecificPrice' => 'override/classes/SpecificPrice.php',
|
||||||
'StateCore' => 'classes/State.php',
|
'StateCore' => 'classes/State.php',
|
||||||
'State' => 'override/classes/State.php',
|
'State' => 'override/classes/State.php',
|
||||||
'StockCore' => 'classes/Stock.php',
|
|
||||||
'Stock' => 'override/classes/Stock.php',
|
|
||||||
'StockMvtCore' => 'classes/StockMvt.php',
|
|
||||||
'StockMvt' => 'override/classes/StockMvt.php',
|
|
||||||
'StockMvtReasonCore' => 'classes/StockMvtReason.php',
|
|
||||||
'StockMvtReason' => 'override/classes/StockMvtReason.php',
|
|
||||||
'StoreCore' => 'classes/Store.php',
|
'StoreCore' => 'classes/Store.php',
|
||||||
'Store' => 'override/classes/Store.php',
|
'Store' => 'override/classes/Store.php',
|
||||||
'SubDomainCore' => 'classes/SubDomain.php',
|
'SubDomainCore' => 'classes/SubDomain.php',
|
||||||
@@ -268,6 +264,8 @@
|
|||||||
'Shop' => 'override/classes/shop/Shop.php',
|
'Shop' => 'override/classes/shop/Shop.php',
|
||||||
'ShopUrlCore' => 'classes/shop/ShopUrl.php',
|
'ShopUrlCore' => 'classes/shop/ShopUrl.php',
|
||||||
'ShopUrl' => 'override/classes/shop/ShopUrl.php',
|
'ShopUrl' => 'override/classes/shop/ShopUrl.php',
|
||||||
|
'StockCore' => 'classes/stock/Stock.php',
|
||||||
|
'Stock' => 'override/classes/Stock.php',
|
||||||
'StockAvailableCore' => 'classes/stock/StockAvailable.php',
|
'StockAvailableCore' => 'classes/stock/StockAvailable.php',
|
||||||
'StockAvailable' => '',
|
'StockAvailable' => '',
|
||||||
'StockManagerCore' => 'classes/stock/StockManager.php',
|
'StockManagerCore' => 'classes/stock/StockManager.php',
|
||||||
@@ -276,6 +274,10 @@
|
|||||||
'StockManagerFactory' => '',
|
'StockManagerFactory' => '',
|
||||||
'StockManagerInterface' => 'classes/stock/StockManagerInterface.php',
|
'StockManagerInterface' => 'classes/stock/StockManagerInterface.php',
|
||||||
'StockManagerModule' => 'classes/stock/StockManagerModule.php',
|
'StockManagerModule' => 'classes/stock/StockManagerModule.php',
|
||||||
|
'StockMvtCore' => 'classes/stock/StockMvt.php',
|
||||||
|
'StockMvt' => 'override/classes/StockMvt.php',
|
||||||
|
'StockMvtReasonCore' => 'classes/stock/StockMvtReason.php',
|
||||||
|
'StockMvtReason' => 'override/classes/StockMvtReason.php',
|
||||||
'WarehouseCore' => 'classes/stock/Warehouse.php',
|
'WarehouseCore' => 'classes/stock/Warehouse.php',
|
||||||
'Warehouse' => '',
|
'Warehouse' => '',
|
||||||
'TaxCore' => 'classes/tax/Tax.php',
|
'TaxCore' => 'classes/tax/Tax.php',
|
||||||
@@ -314,10 +316,14 @@
|
|||||||
'AdminAddressesController' => '',
|
'AdminAddressesController' => '',
|
||||||
'AdminAliasesControllerCore' => 'controllers/admin/AdminAliasesController.php',
|
'AdminAliasesControllerCore' => 'controllers/admin/AdminAliasesController.php',
|
||||||
'AdminAliasesController' => '',
|
'AdminAliasesController' => '',
|
||||||
|
'AdminGendersController' => 'controllers/admin/AdminGendersController.php',
|
||||||
'AdminGroupShopControllerCore' => 'controllers/admin/AdminGroupShopController.php',
|
'AdminGroupShopControllerCore' => 'controllers/admin/AdminGroupShopController.php',
|
||||||
'AdminGroupShopController' => '',
|
'AdminGroupShopController' => '',
|
||||||
'AdminHomeControllerCore' => 'controllers/admin/AdminHomeController.php',
|
'AdminHomeControllerCore' => 'controllers/admin/AdminHomeController.php',
|
||||||
'AdminHomeController' => 'override/controllers/admin/AdminHomeController.php',
|
'AdminHomeController' => 'override/controllers/admin/AdminHomeController.php',
|
||||||
|
'AdminImagesController' => 'controllers/admin/AdminImagesController.php',
|
||||||
|
'AdminOrderMessageController' => 'controllers/admin/AdminOrderMessageController.php',
|
||||||
|
'AdminQuickAccessesController' => 'controllers/admin/AdminQuickAccessesController.php',
|
||||||
'AdminRequestSqlControllerCore' => 'controllers/admin/AdminRequestSqlController.php',
|
'AdminRequestSqlControllerCore' => 'controllers/admin/AdminRequestSqlController.php',
|
||||||
'AdminRequestSqlController' => '',
|
'AdminRequestSqlController' => '',
|
||||||
'AdminSearchEnginesControllerCore' => 'controllers/admin/AdminSearchEnginesController.php',
|
'AdminSearchEnginesControllerCore' => 'controllers/admin/AdminSearchEnginesController.php',
|
||||||
@@ -326,6 +332,8 @@
|
|||||||
'AdminShopUrlController' => '',
|
'AdminShopUrlController' => '',
|
||||||
'AdminStatesControllerCore' => 'controllers/admin/AdminStatesController.php',
|
'AdminStatesControllerCore' => 'controllers/admin/AdminStatesController.php',
|
||||||
'AdminStatesController' => '',
|
'AdminStatesController' => '',
|
||||||
|
'AdminStockControllerCore' => 'controllers/admin/AdminStockController.php',
|
||||||
|
'AdminStockController' => '',
|
||||||
'AdminToolsControllerCore' => 'controllers/admin/AdminToolsController.php',
|
'AdminToolsControllerCore' => 'controllers/admin/AdminToolsController.php',
|
||||||
'AdminToolsController' => 'override/controllers/admin/AdminToolsController.php',
|
'AdminToolsController' => 'override/controllers/admin/AdminToolsController.php',
|
||||||
'AdminTrackingController' => 'controllers/admin/AdminTrackingController.php',
|
'AdminTrackingController' => 'controllers/admin/AdminTrackingController.php',
|
||||||
|
|||||||
@@ -1337,7 +1337,7 @@ class AdminControllerCore extends Controller
|
|||||||
$selectShop = ', shop.name as shop_name ';
|
$selectShop = ', shop.name as shop_name ';
|
||||||
$joinShop = ' LEFT JOIN '._DB_PREFIX_.$this->shopLinkType.' shop
|
$joinShop = ' LEFT JOIN '._DB_PREFIX_.$this->shopLinkType.' shop
|
||||||
ON a.id_'.$this->shopLinkType.' = shop.id_'.$this->shopLinkType;
|
ON a.id_'.$this->shopLinkType.' = shop.id_'.$this->shopLinkType;
|
||||||
$whereShop = $this->context->shop->sqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
|
$whereShop = $this->context->shop->addSqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
|
||||||
}
|
}
|
||||||
$assos = Shop::getAssoTables();
|
$assos = Shop::getAssoTables();
|
||||||
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
|
if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'shop')
|
||||||
|
|||||||
@@ -1311,7 +1311,7 @@ abstract class AdminTabCore
|
|||||||
$selectShop = ', shop.name as shop_name ';
|
$selectShop = ', shop.name as shop_name ';
|
||||||
$joinShop = ' LEFT JOIN '._DB_PREFIX_.$this->shopLinkType.' shop
|
$joinShop = ' LEFT JOIN '._DB_PREFIX_.$this->shopLinkType.' shop
|
||||||
ON a.id_'.$this->shopLinkType.' = shop.id_'.$this->shopLinkType;
|
ON a.id_'.$this->shopLinkType.' = shop.id_'.$this->shopLinkType;
|
||||||
$whereShop = $this->context->shop->sqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
|
$whereShop = $this->context->shop->addSqlRestriction($this->shopShareDatas, 'a', $this->shopLinkType);
|
||||||
}
|
}
|
||||||
|
|
||||||
$assos = Shop::getAssoTables();
|
$assos = Shop::getAssoTables();
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ class AttachmentCore extends ObjectModel
|
|||||||
$ids_attachements[] = $attachement['id_attachment'];
|
$ids_attachements[] = $attachement['id_attachment'];
|
||||||
|
|
||||||
$sql = 'SELECT * FROM `'._DB_PREFIX_.'product_attachment` pa
|
$sql = 'SELECT * FROM `'._DB_PREFIX_.'product_attachment` pa
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pa.`id_product` = pl.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pa.`id_product` = pl.`id_product`'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE `id_attachment` IN ('.implode(',', array_map('intval', $ids_attachements)).')
|
WHERE `id_attachment` IN ('.implode(',', array_map('intval', $ids_attachements)).')
|
||||||
AND pl.`id_lang` = '.(int)$id_lang;
|
AND pl.`id_lang` = '.(int)$id_lang;
|
||||||
$tmp = Db::getInstance()->executeS($sql);
|
$tmp = Db::getInstance()->executeS($sql);
|
||||||
|
|||||||
@@ -167,7 +167,7 @@ class AttributeCore extends ObjectModel
|
|||||||
$sql = 'SELECT quantity
|
$sql = 'SELECT quantity
|
||||||
FROM '._DB_PREFIX_.'stock
|
FROM '._DB_PREFIX_.'stock
|
||||||
WHERE id_product_attribute = '.(int)$id_product_attribute
|
WHERE id_product_attribute = '.(int)$id_product_attribute
|
||||||
.$shop->sqlRestriction(Shop::SHARE_STOCK);
|
.$shop->addSqlRestriction(Shop::SHARE_STOCK);
|
||||||
$result = (int)Db::getInstance()->getValue($sql);
|
$result = (int)Db::getInstance()->getValue($sql);
|
||||||
|
|
||||||
return ($result && $qty <= $result);
|
return ($result && $qty <= $result);
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ class CMSCategoryCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT c.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
|
$sql = 'SELECT c.`id_cms`, cl.`meta_title`, cl.`link_rewrite`
|
||||||
FROM `'._DB_PREFIX_.'cms` c
|
FROM `'._DB_PREFIX_.'cms` c
|
||||||
'.$shop->sqlAsso('cms', 'c', false).'
|
'.$shop->addSqlAssociation('cms', 'c', false).'
|
||||||
JOIN `'._DB_PREFIX_.'cms_lang` cl ON c.`id_cms` = cl.`id_cms`
|
JOIN `'._DB_PREFIX_.'cms_lang` cl ON c.`id_cms` = cl.`id_cms`
|
||||||
WHERE `id_cms_category` = '.(int)$current.'
|
WHERE `id_cms_category` = '.(int)$current.'
|
||||||
AND cl.`id_lang` = '.$id_lang.($active ? ' AND c.`active` = 1' : '').'
|
AND cl.`id_lang` = '.$id_lang.($active ? ' AND c.`active` = 1' : '').'
|
||||||
|
|||||||
+1
-1
@@ -378,7 +378,7 @@ class CarrierCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT c.*, cl.delay
|
$sql = 'SELECT c.*, cl.delay
|
||||||
FROM `'._DB_PREFIX_.'carrier` c
|
FROM `'._DB_PREFIX_.'carrier` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'carrier_lang` cl ON (c.`id_carrier` = cl.`id_carrier` AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'carrier_lang` cl ON (c.`id_carrier` = cl.`id_carrier` AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'carrier_zone` cz ON (cz.`id_carrier` = c.`id_carrier`)'.
|
LEFT JOIN `'._DB_PREFIX_.'carrier_zone` cz ON (cz.`id_carrier` = c.`id_carrier`)'.
|
||||||
($id_zone ? 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = '.(int)$id_zone.')' : '').'
|
($id_zone ? 'LEFT JOIN `'._DB_PREFIX_.'zone` z ON (z.`id_zone` = '.(int)$id_zone.')' : '').'
|
||||||
WHERE c.`deleted` = '.($delete ? '1' : '0').
|
WHERE c.`deleted` = '.($delete ? '1' : '0').
|
||||||
|
|||||||
+3
-3
@@ -382,7 +382,7 @@ class CartCore extends ObjectModel
|
|||||||
|
|
||||||
// Build JOIN
|
// Build JOIN
|
||||||
$sql->leftJoin('product p ON p.`id_product` = cp.`id_product`');
|
$sql->leftJoin('product p ON p.`id_product` = cp.`id_product`');
|
||||||
$sql->leftJoin('product_lang pl ON p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$this->id_lang.Context::getContext()->shop->sqlLang('pl'));
|
$sql->leftJoin('product_lang pl ON p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$this->id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('pl'));
|
||||||
$sql->leftJoin('tax_rule tr ON p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
$sql->leftJoin('tax_rule tr ON p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
AND tr.`id_country` = '.(int)$id_country.'
|
AND tr.`id_country` = '.(int)$id_country.'
|
||||||
AND tr.`id_state` = 0
|
AND tr.`id_state` = 0
|
||||||
@@ -390,7 +390,7 @@ class CartCore extends ObjectModel
|
|||||||
$sql->leftJoin('tax t ON t.`id_tax` = tr.`id_tax`');
|
$sql->leftJoin('tax t ON t.`id_tax` = tr.`id_tax`');
|
||||||
$sql->leftJoin('stock_available sa ON sa.`id_product` = p.`id_product` AND sa.id_product_attribute = 0');
|
$sql->leftJoin('stock_available sa ON sa.`id_product` = p.`id_product` AND sa.id_product_attribute = 0');
|
||||||
$sql->leftJoin('tax_lang tl ON t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$this->id_lang);
|
$sql->leftJoin('tax_lang tl ON t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$this->id_lang);
|
||||||
$sql->leftJoin('category_lang cl ON p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->id_lang.Context::getContext()->shop->sqlLang('cl'));
|
$sql->leftJoin('category_lang cl ON p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$this->id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl'));
|
||||||
|
|
||||||
// @todo test if everything is ok, then refactorise call of this method
|
// @todo test if everything is ok, then refactorise call of this method
|
||||||
Product::sqlStock('cp', 'cp', false, null, $sql);
|
Product::sqlStock('cp', 'cp', false, null, $sql);
|
||||||
@@ -1518,7 +1518,7 @@ class CartCore extends ObjectModel
|
|||||||
LEFT JOIN '._DB_PREFIX_.'orders o ON (c.`id_cart` = o.`id_cart`)
|
LEFT JOIN '._DB_PREFIX_.'orders o ON (c.`id_cart` = o.`id_cart`)
|
||||||
WHERE c.`id_customer` = '.(int)($id_customer).'
|
WHERE c.`id_customer` = '.(int)($id_customer).'
|
||||||
AND o.`id_cart` IS NULL
|
AND o.`id_cart` IS NULL
|
||||||
'.Context::getContext()->shop->sqlRestriction(Shop::SHARE_ORDER, 'c').'
|
'.Context::getContext()->shop->addSqlRestriction(Shop::SHARE_ORDER, 'c').'
|
||||||
ORDER BY c.`date_upd` DESC';
|
ORDER BY c.`date_upd` DESC';
|
||||||
if (!$id_cart = Db::getInstance()->getValue($sql))
|
if (!$id_cart = Db::getInstance()->getValue($sql))
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+15
-15
@@ -441,7 +441,7 @@ class CategoryCore extends ObjectModel
|
|||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT *
|
SELECT *
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').'
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->addSqlRestrictionOnLang('cl').'
|
||||||
WHERE 1 '.$sql_filter.' '.($id_lang ? 'AND `id_lang` = '.(int)($id_lang) : '').'
|
WHERE 1 '.$sql_filter.' '.($id_lang ? 'AND `id_lang` = '.(int)($id_lang) : '').'
|
||||||
'.($active ? 'AND `active` = 1' : '').'
|
'.($active ? 'AND `active` = 1' : '').'
|
||||||
'.(!$id_lang ? 'GROUP BY c.id_category' : '').'
|
'.(!$id_lang ? 'GROUP BY c.id_category' : '').'
|
||||||
@@ -464,7 +464,7 @@ class CategoryCore extends ObjectModel
|
|||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT c.`id_category`, cl.`name`
|
SELECT c.`id_category`, cl.`name`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||||
GROUP BY c.id_category
|
GROUP BY c.id_category
|
||||||
ORDER BY c.`position`');
|
ORDER BY c.`position`');
|
||||||
@@ -488,7 +488,7 @@ class CategoryCore extends ObjectModel
|
|||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description
|
SELECT c.*, cl.id_lang, cl.name, cl.description, cl.link_rewrite, cl.meta_title, cl.meta_keywords, cl.meta_description
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
||||||
WHERE `id_parent` = '.(int)($this->id).'
|
WHERE `id_parent` = '.(int)($this->id).'
|
||||||
'.($active ? 'AND `active` = 1' : '').'
|
'.($active ? 'AND `active` = 1' : '').'
|
||||||
@@ -559,7 +559,7 @@ class CategoryCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(cp.`id_product`) AS total
|
$sql = 'SELECT COUNT(cp.`id_product`) AS total
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
|
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`
|
||||||
WHERE cp.`id_category` = '.(int)($this->id).
|
WHERE cp.`id_category` = '.(int)($this->id).
|
||||||
($active ? ' AND p.`active` = 1' : '').
|
($active ? ' AND p.`active` = 1' : '').
|
||||||
@@ -572,10 +572,10 @@ class CategoryCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'category_product` cp
|
FROM `'._DB_PREFIX_.'category_product` cp
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = cp.`id_product`
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND default_on = 1)
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND default_on = 1)
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
'.Product::sqlStock('p', 'pa', false, $context->shop).'
|
'.Product::sqlStock('p', 'pa', false, $context->shop).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
@@ -646,7 +646,7 @@ class CategoryCore extends ObjectModel
|
|||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`
|
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').'
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->addSqlRestrictionOnLang('cl').'
|
||||||
WHERE `id_lang` = '.(int)($id_lang).'
|
WHERE `id_lang` = '.(int)($id_lang).'
|
||||||
AND c.`id_parent` = '.(int)($id_parent).'
|
AND c.`id_parent` = '.(int)($id_parent).'
|
||||||
'.($active ? 'AND `active` = 1' : '').'
|
'.($active ? 'AND `active` = 1' : '').'
|
||||||
@@ -692,7 +692,7 @@ class CategoryCore extends ObjectModel
|
|||||||
AND c3.`id_category` IN ('.implode(',', array_map('intval', $selectedCat)).')
|
AND c3.`id_category` IN ('.implode(',', array_map('intval', $selectedCat)).')
|
||||||
)' : '0').' AS nbSelectedSubCat
|
)' : '0').' AS nbSelectedSubCat
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.$shop->sqlLang('cl').'
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.$shop->addSqlRestrictionOnLang('cl').'
|
||||||
WHERE `id_lang` = '.(int)($id_lang).'
|
WHERE `id_lang` = '.(int)($id_lang).'
|
||||||
AND c.`id_parent` = '.(int)($id_parent).'
|
AND c.`id_parent` = '.(int)($id_parent).'
|
||||||
ORDER BY `position` ASC';
|
ORDER BY `position` ASC';
|
||||||
@@ -757,7 +757,7 @@ class CategoryCore extends ObjectModel
|
|||||||
$result = Db::getInstance()->getRow('
|
$result = Db::getInstance()->getRow('
|
||||||
SELECT cl.`link_rewrite`
|
SELECT cl.`link_rewrite`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').'
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`'.Context::getContext()->shop->addSqlRestrictionOnLang('cl').'
|
||||||
WHERE `id_lang` = '.(int)($id_lang).'
|
WHERE `id_lang` = '.(int)($id_lang).'
|
||||||
AND c.`id_category` = '.(int)($id_category));
|
AND c.`id_category` = '.(int)($id_category));
|
||||||
self::$_links[$id_category.'-'.$id_lang] = $result['link_rewrite'];
|
self::$_links[$id_category.'-'.$id_lang] = $result['link_rewrite'];
|
||||||
@@ -797,13 +797,13 @@ class CategoryCore extends ObjectModel
|
|||||||
return Db::getInstance()->getRow('
|
return Db::getInstance()->getRow('
|
||||||
SELECT c.*, cl.*
|
SELECT c.*, cl.*
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE `name` LIKE \''.pSQL($query).'\'');
|
WHERE `name` LIKE \''.pSQL($query).'\'');
|
||||||
else
|
else
|
||||||
return Db::getInstance()->executeS('
|
return Db::getInstance()->executeS('
|
||||||
SELECT c.*, cl.*
|
SELECT c.*, cl.*
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE `name` LIKE \'%'.pSQL($query).'%\' AND c.`id_category` != 1');
|
WHERE `name` LIKE \'%'.pSQL($query).'%\' AND c.`id_category` != 1');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -820,7 +820,7 @@ class CategoryCore extends ObjectModel
|
|||||||
return Db::getInstance()->getRow('
|
return Db::getInstance()->getRow('
|
||||||
SELECT c.*, cl.*
|
SELECT c.*, cl.*
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE `name` LIKE \''.pSQL($category_name).'\'
|
WHERE `name` LIKE \''.pSQL($category_name).'\'
|
||||||
AND c.`id_category` != 1
|
AND c.`id_category` != 1
|
||||||
AND c.`id_parent` = '.(int)($id_parent_category));
|
AND c.`id_parent` = '.(int)($id_parent_category));
|
||||||
@@ -844,7 +844,7 @@ class CategoryCore extends ObjectModel
|
|||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT c.*, cl.*
|
SELECT c.*, cl.*
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE c.`id_category` = '.(int)$idCurrent.' AND c.`id_parent` != 0
|
WHERE c.`id_category` = '.(int)$idCurrent.' AND c.`id_parent` != 0
|
||||||
');
|
');
|
||||||
|
|
||||||
@@ -1142,7 +1142,7 @@ class CategoryCore extends ObjectModel
|
|||||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, cl.`id_lang`
|
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, cl.`id_lang`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`'.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||||
AND c.`id_category` IN ('.implode(',', array_map('intval', $ids_category)).')
|
AND c.`id_category` IN ('.implode(',', array_map('intval', $ids_category)).')
|
||||||
');
|
');
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ class ConnectionCore extends ObjectModel
|
|||||||
$sql = 'SELECT `id_connections` FROM `'._DB_PREFIX_.'connections`
|
$sql = 'SELECT `id_connections` FROM `'._DB_PREFIX_.'connections`
|
||||||
WHERE ip_address = '.ip2long(Tools::getRemoteAddr()).'
|
WHERE ip_address = '.ip2long(Tools::getRemoteAddr()).'
|
||||||
AND DATE_ADD(`date_add`, INTERVAL 30 MINUTE) > \''.pSQL(date('Y-m-d H:i:00')).'\'
|
AND DATE_ADD(`date_add`, INTERVAL 30 MINUTE) > \''.pSQL(date('Y-m-d H:i:00')).'\'
|
||||||
'.$shop->sqlRestriction(Shop::SHARE_CUSTOMER).'
|
'.$shop->addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||||
ORDER BY `date_add` DESC';
|
ORDER BY `date_add` DESC';
|
||||||
if ($id_connections = Db::getInstance()->getValue($sql))
|
if ($id_connections = Db::getInstance()->getValue($sql))
|
||||||
{
|
{
|
||||||
@@ -117,7 +117,7 @@ class ConnectionCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'connections`
|
FROM `'._DB_PREFIX_.'connections`
|
||||||
WHERE `id_guest` = '.(int)($cookie->id_guest).'
|
WHERE `id_guest` = '.(int)($cookie->id_guest).'
|
||||||
AND DATE_ADD(`date_add`, INTERVAL 30 MINUTE) > \''.pSQL(date('Y-m-d H:i:00')).'\'
|
AND DATE_ADD(`date_add`, INTERVAL 30 MINUTE) > \''.pSQL(date('Y-m-d H:i:00')).'\'
|
||||||
'.$shop->sqlRestriction(Shop::SHARE_CUSTOMER).'
|
'.$shop->addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||||
ORDER BY `date_add` DESC';
|
ORDER BY `date_add` DESC';
|
||||||
$result = Db::getInstance()->getRow($sql);
|
$result = Db::getInstance()->getRow($sql);
|
||||||
if (!$result['id_guest'] AND (int)($cookie->id_guest))
|
if (!$result['id_guest'] AND (int)($cookie->id_guest))
|
||||||
|
|||||||
+1
-1
@@ -83,7 +83,7 @@ class ContactCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM `'._DB_PREFIX_.'contact` c
|
FROM `'._DB_PREFIX_.'contact` c
|
||||||
'.$shop->sqlAsso('contact', 'c', false).'
|
'.$shop->addSqlAssociation('contact', 'c', false).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (c.`id_contact` = cl.`id_contact`)
|
LEFT JOIN `'._DB_PREFIX_.'contact_lang` cl ON (c.`id_contact` = cl.`id_contact`)
|
||||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||||
ORDER BY `name` ASC';
|
ORDER BY `name` ASC';
|
||||||
|
|||||||
+2
-2
@@ -133,7 +133,7 @@ class CountryCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT cl.*,c.*, cl.`name` AS country, z.`name` AS zone
|
$sql = 'SELECT cl.*,c.*, cl.`name` AS country, z.`name` AS zone
|
||||||
FROM `'._DB_PREFIX_.'country` c
|
FROM `'._DB_PREFIX_.'country` c
|
||||||
'.$shop->sqlAsso('country', 'c', false).'
|
'.$shop->addSqlAssociation('country', 'c', false).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'zone` z ON z.`id_zone` = c.`id_zone`
|
LEFT JOIN `'._DB_PREFIX_.'zone` z ON z.`id_zone` = c.`id_zone`
|
||||||
WHERE 1'
|
WHERE 1'
|
||||||
@@ -290,7 +290,7 @@ class CountryCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = ' SELECT DISTINCT c.*, cl.*
|
$sql = ' SELECT DISTINCT c.*, cl.*
|
||||||
FROM `'._DB_PREFIX_.'country` c
|
FROM `'._DB_PREFIX_.'country` c
|
||||||
'.$shop->sqlAsso('country', 'c', false).'
|
'.$shop->addSqlAssociation('country', 'c', false).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_country` = c.`id_country`)
|
LEFT JOIN `'._DB_PREFIX_.'state` s ON (s.`id_country` = c.`id_country`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`)
|
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country`)
|
||||||
WHERE (c.`id_zone` = '.(int)$id_zone.' OR s.`id_zone` = '.(int)$id_zone.')
|
WHERE (c.`id_zone` = '.(int)$id_zone.' OR s.`id_zone` = '.(int)$id_zone.')
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ class CurrencyCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT *
|
$sql = 'SELECT *
|
||||||
FROM `'._DB_PREFIX_.'currency` c
|
FROM `'._DB_PREFIX_.'currency` c
|
||||||
'.$shop->sqlAsso('currency', 'c').'
|
'.$shop->addSqlAssociation('currency', 'c').'
|
||||||
WHERE `deleted` = 0'
|
WHERE `deleted` = 0'
|
||||||
.($active == 1 ? ' AND c.`active` = 1' : '').'
|
.($active == 1 ? ' AND c.`active` = 1' : '').'
|
||||||
ORDER BY `name` ASC';
|
ORDER BY `name` ASC';
|
||||||
|
|||||||
@@ -215,7 +215,7 @@ class CustomerCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT `id_customer`, `email`, `firstname`, `lastname`
|
$sql = 'SELECT `id_customer`, `email`, `firstname`, `lastname`
|
||||||
FROM `'._DB_PREFIX_.'customer`
|
FROM `'._DB_PREFIX_.'customer`
|
||||||
WHERE 1 '.$shop->sqlRestriction(Shop::SHARE_CUSTOMER).'
|
WHERE 1 '.$shop->addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||||
ORDER BY `id_customer` ASC';
|
ORDER BY `id_customer` ASC';
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
}
|
}
|
||||||
@@ -239,7 +239,7 @@ class CustomerCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_ .'customer`
|
FROM `'._DB_PREFIX_ .'customer`
|
||||||
WHERE `active` = 1
|
WHERE `active` = 1
|
||||||
AND `email` = \''.pSQL($email).'\'
|
AND `email` = \''.pSQL($email).'\'
|
||||||
'.$shop->sqlRestriction(Shop::SHARE_CUSTOMER).'
|
'.$shop->addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||||
'.(isset($passwd) ? 'AND `passwd` = \''.md5(_COOKIE_KEY_.$passwd).'\'' : '').'
|
'.(isset($passwd) ? 'AND `passwd` = \''.md5(_COOKIE_KEY_.$passwd).'\'' : '').'
|
||||||
AND `deleted` = 0
|
AND `deleted` = 0
|
||||||
AND `is_guest` = 0';
|
AND `is_guest` = 0';
|
||||||
@@ -294,7 +294,7 @@ class CustomerCore extends ObjectModel
|
|||||||
$sql = 'SELECT `id_customer`
|
$sql = 'SELECT `id_customer`
|
||||||
FROM `'._DB_PREFIX_.'customer`
|
FROM `'._DB_PREFIX_.'customer`
|
||||||
WHERE `email` = \''.pSQL($email).'\'
|
WHERE `email` = \''.pSQL($email).'\'
|
||||||
'.$shop->sqlRestriction(Shop::SHARE_CUSTOMER).
|
'.$shop->addSqlRestriction(Shop::SHARE_CUSTOMER).
|
||||||
($ignoreGuest ? 'AND `is_guest` = 0' : '');
|
($ignoreGuest ? 'AND `is_guest` = 0' : '');
|
||||||
$result = Db::getInstance()->getRow($sql);
|
$result = Db::getInstance()->getRow($sql);
|
||||||
|
|
||||||
@@ -398,7 +398,7 @@ class CustomerCore extends ObjectModel
|
|||||||
OR `id_customer` LIKE \'%'.pSQL($query).'%\'
|
OR `id_customer` LIKE \'%'.pSQL($query).'%\'
|
||||||
OR `lastname` LIKE \'%'.pSQL($query).'%\'
|
OR `lastname` LIKE \'%'.pSQL($query).'%\'
|
||||||
OR `firstname` LIKE \'%'.pSQL($query).'%\'
|
OR `firstname` LIKE \'%'.pSQL($query).'%\'
|
||||||
)'.$shop->sqlRestriction(Shop::SHARE_CUSTOMER);
|
)'.$shop->addSqlRestriction(Shop::SHARE_CUSTOMER);
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -275,7 +275,7 @@ class DispatcherCore
|
|||||||
// Load routes from meta table
|
// Load routes from meta table
|
||||||
$sql = 'SELECT m.page, ml.url_rewrite
|
$sql = 'SELECT m.page, ml.url_rewrite
|
||||||
FROM `'._DB_PREFIX_.'meta` m
|
FROM `'._DB_PREFIX_.'meta` m
|
||||||
LEFT JOIN `'._DB_PREFIX_.'meta_lang` ml ON (m.id_meta = ml.id_meta'.$context->shop->sqlLang('ml').')
|
LEFT JOIN `'._DB_PREFIX_.'meta_lang` ml ON (m.id_meta = ml.id_meta'.$context->shop->addSqlRestrictionOnLang('ml').')
|
||||||
WHERE id_lang = '.(int)$context->language->id.'
|
WHERE id_lang = '.(int)$context->language->id.'
|
||||||
ORDER BY LENGTH(ml.url_rewrite) DESC';
|
ORDER BY LENGTH(ml.url_rewrite) DESC';
|
||||||
if ($results = Db::getInstance()->executeS($sql))
|
if ($results = Db::getInstance()->executeS($sql))
|
||||||
|
|||||||
@@ -125,7 +125,7 @@ class GroupReductionCore extends ObjectModel
|
|||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT gr.`id_group_reduction`, gr.`id_group`, gr.`id_category`, gr.`reduction`, cl.`name` AS category_name
|
SELECT gr.`id_group_reduction`, gr.`id_group`, gr.`id_category`, gr.`reduction`, cl.`name` AS category_name
|
||||||
FROM `'._DB_PREFIX_.'group_reduction` gr
|
FROM `'._DB_PREFIX_.'group_reduction` gr
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = gr.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = gr.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE `id_group` = '.(int)($id_group)
|
WHERE `id_group` = '.(int)($id_group)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
$sql = '
|
$sql = '
|
||||||
SELECT p.`id_product`
|
SELECT p.`id_product`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
WHERE p.id_manufacturer = '.(int)($id_manufacturer)
|
WHERE p.id_manufacturer = '.(int)($id_manufacturer)
|
||||||
.($active ? ' AND p.`active` = 1' : '').'
|
.($active ? ' AND p.`active` = 1' : '').'
|
||||||
AND p.`id_product` IN (
|
AND p.`id_product` IN (
|
||||||
@@ -280,9 +280,9 @@ class ManufacturerCore extends ObjectModel
|
|||||||
$sql = 'SELECT p.*, sa.out_of_stock, pa.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new,
|
$sql = 'SELECT p.*, sa.out_of_stock, pa.`id_product_attribute`, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, m.`name` AS manufacturer_name, tl.`name` AS tax_name, t.`rate`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new,
|
||||||
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice
|
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND default_on = 1)
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND default_on = 1)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
@@ -316,7 +316,7 @@ class ManufacturerCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT p.`id_product`, pl.`name`
|
$sql = 'SELECT p.`id_product`, pl.`name`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE p.`id_manufacturer` = '.(int)$this->id;
|
WHERE p.`id_manufacturer` = '.(int)$this->id;
|
||||||
return Db::getInstance()->executeS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -104,7 +104,7 @@ class MetaCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'meta` m
|
FROM `'._DB_PREFIX_.'meta` m
|
||||||
LEFT JOIN `'._DB_PREFIX_.'meta_lang` ml ON m.`id_meta` = ml.`id_meta`
|
LEFT JOIN `'._DB_PREFIX_.'meta_lang` ml ON m.`id_meta` = ml.`id_meta`
|
||||||
WHERE ml.`id_lang` = '.(int)$id_lang
|
WHERE ml.`id_lang` = '.(int)$id_lang
|
||||||
.$shop->sqlLang('ml').
|
.$shop->addSqlRestrictionOnLang('ml').
|
||||||
'ORDER BY page ASC';
|
'ORDER BY page ASC';
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ class MetaCore extends ObjectModel
|
|||||||
LEFT JOIN '._DB_PREFIX_.'meta_lang ml on (m.id_meta = ml.id_meta)
|
LEFT JOIN '._DB_PREFIX_.'meta_lang ml on (m.id_meta = ml.id_meta)
|
||||||
WHERE m.page = \''.pSQL($page).'\'
|
WHERE m.page = \''.pSQL($page).'\'
|
||||||
AND ml.id_lang = '.(int)$id_lang
|
AND ml.id_lang = '.(int)$id_lang
|
||||||
.$context->shop->sqlLang('ml');
|
.$context->shop->addSqlRestrictionOnLang('ml');
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -142,7 +142,7 @@ abstract class ModuleCore
|
|||||||
|
|
||||||
protected function sqlShopRestriction($share = false, $alias = null)
|
protected function sqlShopRestriction($share = false, $alias = null)
|
||||||
{
|
{
|
||||||
return $this->context->shop->sqlRestriction($share, $alias, 'shop');
|
return $this->context->shop->addSqlRestriction($share, $alias, 'shop');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+8
-8
@@ -679,7 +679,7 @@ class OrderCore extends ObjectModel
|
|||||||
$sql = 'SELECT `id_order`
|
$sql = 'SELECT `id_order`
|
||||||
FROM `'._DB_PREFIX_.'orders`
|
FROM `'._DB_PREFIX_.'orders`
|
||||||
WHERE DATE_ADD(date_upd, INTERVAL -1 DAY) <= \''.pSQL($date_to).'\' AND date_upd >= \''.pSQL($date_from).'\'
|
WHERE DATE_ADD(date_upd, INTERVAL -1 DAY) <= \''.pSQL($date_to).'\' AND date_upd >= \''.pSQL($date_from).'\'
|
||||||
'.Context::getContext()->shop->sqlRestriction()
|
'.Context::getContext()->shop->addSqlRestriction()
|
||||||
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
|
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
|
||||||
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '');
|
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '');
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
@@ -707,7 +707,7 @@ class OrderCore extends ObjectModel
|
|||||||
FROM `'._DB_PREFIX_.'orders` o
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = o.`id_customer`)
|
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = o.`id_customer`)
|
||||||
WHERE 1
|
WHERE 1
|
||||||
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
|
'.Context::getContext()->shop->addSqlRestriction(false, 'o').'
|
||||||
ORDER BY o.`date_add` DESC
|
ORDER BY o.`date_add` DESC
|
||||||
'.((int)$limit ? 'LIMIT 0, '.(int)$limit : '');
|
'.((int)$limit ? 'LIMIT 0, '.(int)$limit : '');
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
@@ -718,7 +718,7 @@ class OrderCore extends ObjectModel
|
|||||||
$sql = 'SELECT `id_order`
|
$sql = 'SELECT `id_order`
|
||||||
FROM `'._DB_PREFIX_.'orders`
|
FROM `'._DB_PREFIX_.'orders`
|
||||||
WHERE DATE_ADD(invoice_date, INTERVAL -1 DAY) <= \''.pSQL($date_to).'\' AND invoice_date >= \''.pSQL($date_from).'\'
|
WHERE DATE_ADD(invoice_date, INTERVAL -1 DAY) <= \''.pSQL($date_to).'\' AND invoice_date >= \''.pSQL($date_from).'\'
|
||||||
'.Context::getContext()->shop->sqlRestriction()
|
'.Context::getContext()->shop->addSqlRestriction()
|
||||||
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
|
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
|
||||||
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '').
|
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '').
|
||||||
' ORDER BY invoice_date ASC';
|
' ORDER BY invoice_date ASC';
|
||||||
@@ -741,7 +741,7 @@ class OrderCore extends ObjectModel
|
|||||||
ORDER BY date_add DESC, id_order_history DESC
|
ORDER BY date_add DESC, id_order_history DESC
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
)
|
)
|
||||||
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
|
'.Context::getContext()->shop->addSqlRestriction(false, 'o').'
|
||||||
ORDER BY invoice_date ASC';
|
ORDER BY invoice_date ASC';
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
|
|
||||||
@@ -812,7 +812,7 @@ class OrderCore extends ObjectModel
|
|||||||
$sql = 'SELECT COUNT(`id_order`) AS nb
|
$sql = 'SELECT COUNT(`id_order`) AS nb
|
||||||
FROM `'._DB_PREFIX_.'orders`
|
FROM `'._DB_PREFIX_.'orders`
|
||||||
WHERE `id_customer` = '.(int)$id_customer
|
WHERE `id_customer` = '.(int)$id_customer
|
||||||
.Context::getContext()->shop->sqlRestriction();
|
.Context::getContext()->shop->addSqlRestriction();
|
||||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||||
|
|
||||||
return isset($result['nb']) ? $result['nb'] : 0;
|
return isset($result['nb']) ? $result['nb'] : 0;
|
||||||
@@ -829,7 +829,7 @@ class OrderCore extends ObjectModel
|
|||||||
$sql = 'SELECT `id_order`
|
$sql = 'SELECT `id_order`
|
||||||
FROM `'._DB_PREFIX_.'orders`
|
FROM `'._DB_PREFIX_.'orders`
|
||||||
WHERE `id_cart` = '.(int)($id_cart)
|
WHERE `id_cart` = '.(int)($id_cart)
|
||||||
.Context::getContext()->shop->sqlRestriction();
|
.Context::getContext()->shop->addSqlRestriction();
|
||||||
$result = Db::getInstance()->getRow($sql);
|
$result = Db::getInstance()->getRow($sql);
|
||||||
|
|
||||||
return isset($result['id_order']) ? $result['id_order'] : false;
|
return isset($result['id_order']) ? $result['id_order'] : false;
|
||||||
@@ -948,7 +948,7 @@ class OrderCore extends ObjectModel
|
|||||||
$sql = 'SELECT id_order
|
$sql = 'SELECT id_order
|
||||||
FROM `'._DB_PREFIX_.'orders`
|
FROM `'._DB_PREFIX_.'orders`
|
||||||
WHERE `delivery_number` = '.(int)($id_delivery).'
|
WHERE `delivery_number` = '.(int)($id_delivery).'
|
||||||
'.Context::getContext()->shop->sqlRestriction();
|
'.Context::getContext()->shop->addSqlRestriction();
|
||||||
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||||
return new Order((int)($res['id_order']));
|
return new Order((int)($res['id_order']));
|
||||||
}
|
}
|
||||||
@@ -981,7 +981,7 @@ class OrderCore extends ObjectModel
|
|||||||
WHERE o.`id_order` = '.(int)$this->id.'
|
WHERE o.`id_order` = '.(int)$this->id.'
|
||||||
AND c.`email` = \''.pSQL($email).'\'
|
AND c.`email` = \''.pSQL($email).'\'
|
||||||
AND c.`is_guest` = 1
|
AND c.`is_guest` = 1
|
||||||
'.Context::getContext()->shop->sqlRestriction(false, 'c');
|
'.Context::getContext()->shop->addSqlRestriction(false, 'c');
|
||||||
return (bool)Db::getInstance()->getValue($sql);
|
return (bool)Db::getInstance()->getValue($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -106,10 +106,10 @@ class PackCore extends Product
|
|||||||
$sql = 'SELECT p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity
|
$sql = 'SELECT p.*, pl.*, i.`id_image`, il.`legend`, t.`rate`, cl.`name` AS category_default, a.quantity AS pack_quantity
|
||||||
FROM `'._DB_PREFIX_.'pack` a
|
FROM `'._DB_PREFIX_.'pack` a
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = a.id_product_item
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.id_product = pl.id_product AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.id_product = pl.id_product AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||||
AND tr.`id_state` = 0)
|
AND tr.`id_state` = 0)
|
||||||
@@ -152,7 +152,7 @@ class PackCore extends Product
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)
|
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.')
|
LEFT JOIN `'._DB_PREFIX_.'tax_lang` tl ON (t.`id_tax` = tl.`id_tax` AND tl.`id_lang` = '.(int)$id_lang.')
|
||||||
WHERE pl.`id_lang` = '.(int)$id_lang.'
|
WHERE pl.`id_lang` = '.(int)$id_lang.'
|
||||||
'.Context::getContext()->shop->sqlLang('pl').'
|
'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').'
|
||||||
AND p.`id_product` IN ('.$packs.')';
|
AND p.`id_product` IN ('.$packs.')';
|
||||||
if ($limit)
|
if ($limit)
|
||||||
$sql .= ' LIMIT '.(int)$limit;
|
$sql .= ' LIMIT '.(int)$limit;
|
||||||
|
|||||||
+11
-11
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
* 2007-2011 PrestaShop
|
* 2007-2011 PrestaShop
|
||||||
*
|
*
|
||||||
* NOTICE OF LICENSE
|
* NOTICE OF LICENSE
|
||||||
*
|
*
|
||||||
@@ -29,15 +29,15 @@ class PageCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
public $id_page_type;
|
public $id_page_type;
|
||||||
public $id_object;
|
public $id_object;
|
||||||
|
|
||||||
public $name;
|
public $name;
|
||||||
|
|
||||||
protected $fieldsRequired = array ('id_page_type');
|
protected $fieldsRequired = array ('id_page_type');
|
||||||
protected $fieldsValidate = array ('id_page_type' => 'isUnsignedId', 'id_object' => 'isUnsignedId');
|
protected $fieldsValidate = array ('id_page_type' => 'isUnsignedId', 'id_object' => 'isUnsignedId');
|
||||||
|
|
||||||
protected $table = 'page';
|
protected $table = 'page';
|
||||||
protected $identifier = 'id_page';
|
protected $identifier = 'id_page';
|
||||||
|
|
||||||
public function getFields()
|
public function getFields()
|
||||||
{
|
{
|
||||||
$this->validateFields();
|
$this->validateFields();
|
||||||
@@ -45,7 +45,7 @@ class PageCore extends ObjectModel
|
|||||||
$fields['id_object'] = (int)($this->id_object);
|
$fields['id_object'] = (int)($this->id_object);
|
||||||
return $fields;
|
return $fields;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return int Current page ID
|
* @return int Current page ID
|
||||||
*/
|
*/
|
||||||
@@ -53,7 +53,7 @@ class PageCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$controller = Dispatcher::getInstance()->getController();
|
$controller = Dispatcher::getInstance()->getController();
|
||||||
$pageTypeID = Page::getPageTypeByName($controller);
|
$pageTypeID = Page::getPageTypeByName($controller);
|
||||||
|
|
||||||
// Some pages must be distinguished in order to record exactly what is being seen
|
// Some pages must be distinguished in order to record exactly what is being seen
|
||||||
// @todo dispatcher module
|
// @todo dispatcher module
|
||||||
$specialArray = array(
|
$specialArray = array(
|
||||||
@@ -85,10 +85,10 @@ class PageCore extends ObjectModel
|
|||||||
Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.'page', $insertData, 'INSERT');
|
Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.'page', $insertData, 'INSERT');
|
||||||
return Db::getInstance()->Insert_ID();
|
return Db::getInstance()->Insert_ID();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return page type ID from page name
|
* Return page type ID from page name
|
||||||
*
|
*
|
||||||
* @param string $name Page name (E.g. product.php)
|
* @param string $name Page name (E.g. product.php)
|
||||||
*/
|
*/
|
||||||
public static function getPageTypeByName($name)
|
public static function getPageTypeByName($name)
|
||||||
@@ -98,18 +98,18 @@ class PageCore extends ObjectModel
|
|||||||
WHERE name = \''.pSQL($name).'\'';
|
WHERE name = \''.pSQL($name).'\'';
|
||||||
if ($value = Db::getInstance()->getValue($sql))
|
if ($value = Db::getInstance()->getValue($sql))
|
||||||
return $value;
|
return $value;
|
||||||
|
|
||||||
Db::getInstance()->autoExecute(_DB_PREFIX_.'page_type', array(
|
Db::getInstance()->autoExecute(_DB_PREFIX_.'page_type', array(
|
||||||
'name' => $name,
|
'name' => $name,
|
||||||
), 'INSERT');
|
), 'INSERT');
|
||||||
return Db::getInstance()->Insert_ID();
|
return Db::getInstance()->Insert_ID();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function setPageViewed($id_page)
|
public static function setPageViewed($id_page)
|
||||||
{
|
{
|
||||||
$id_date_range = DateRange::getCurrentRange();
|
$id_date_range = DateRange::getCurrentRange();
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
|
|
||||||
// Try to increment the visits counter
|
// Try to increment the visits counter
|
||||||
$sql = 'UPDATE `'._DB_PREFIX_.'page_viewed`
|
$sql = 'UPDATE `'._DB_PREFIX_.'page_viewed`
|
||||||
SET `counter` = `counter` + 1
|
SET `counter` = `counter` + 1
|
||||||
|
|||||||
+30
-30
@@ -820,8 +820,8 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT p.*, pl.* , t.`rate` AS tax_rate, m.`name` AS manufacturer_name, s.`name` AS supplier_name
|
$sql = 'SELECT p.*, pl.* , t.`rate` AS tax_rate, m.`name` AS manufacturer_name, s.`name` AS supplier_name
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||||
AND tr.`id_state` = 0)
|
AND tr.`id_state` = 0)
|
||||||
@@ -847,8 +847,8 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT p.`id_product`, pl.`name`
|
$sql = 'SELECT p.`id_product`, pl.`name`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p', false).'
|
'.$context->shop->addSqlAssociation('product', 'p', false).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` '.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE pl.`id_lang` = '.(int)$id_lang.'
|
WHERE pl.`id_lang` = '.(int)$id_lang.'
|
||||||
ORDER BY pl.`name`';
|
ORDER BY pl.`name`';
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
@@ -1412,7 +1412,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(p.`id_product`) AS nb
|
$sql = 'SELECT COUNT(p.`id_product`) AS nb
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
WHERE `active` = 1
|
WHERE `active` = 1
|
||||||
AND DATEDIFF(p.`date_add`,
|
AND DATEDIFF(p.`date_add`,
|
||||||
DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0
|
DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0
|
||||||
@@ -1432,8 +1432,8 @@ class ProductCore extends ObjectModel
|
|||||||
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice');
|
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice');
|
||||||
|
|
||||||
$sql->from('product p');
|
$sql->from('product p');
|
||||||
$sql->join($context->shop->sqlAsso('product', 'p'));
|
$sql->join($context->shop->addSqlAssociation('product', 'p'));
|
||||||
$sql->leftJoin('product_lang pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')');
|
$sql->leftJoin('product_lang pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')');
|
||||||
$sql->leftJoin('image i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)');
|
$sql->leftJoin('image i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)');
|
||||||
$sql->leftJoin('image_lang il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')');
|
$sql->leftJoin('image_lang il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')');
|
||||||
$sql->leftJoin('tax_rule tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = '.(int)$context->country->id.' AND tr.`id_state` = 0)');
|
$sql->leftJoin('tax_rule tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group` AND tr.`id_country` = '.(int)$context->country->id.' AND tr.`id_state` = 0)');
|
||||||
@@ -1505,7 +1505,7 @@ class ProductCore extends ObjectModel
|
|||||||
// Please keep 2 distinct queries because RAND() is an awful way to achieve this result
|
// Please keep 2 distinct queries because RAND() is an awful way to achieve this result
|
||||||
$sql = 'SELECT p.id_product
|
$sql = 'SELECT p.id_product
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
'.(($ids_product) ? 'AND p.`id_product` IN ('.implode(', ', $ids_product).')' : '').'
|
'.(($ids_product) ? 'AND p.`id_product` IN ('.implode(', ', $ids_product).')' : '').'
|
||||||
AND p.`id_product` IN (
|
AND p.`id_product` IN (
|
||||||
@@ -1523,7 +1523,7 @@ class ProductCore extends ObjectModel
|
|||||||
$sql = 'SELECT p.*, sa.out_of_stock, sa.out_of_stock out_of_stock, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`,
|
$sql = 'SELECT p.*, sa.out_of_stock, sa.out_of_stock out_of_stock, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, p.`ean13`, p.`upc`,
|
||||||
i.`id_image`, il.`legend`, t.`rate`
|
i.`id_image`, il.`legend`, t.`rate`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
@@ -1572,7 +1572,7 @@ class ProductCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(DISTINCT p.`id_product`) AS nb
|
$sql = 'SELECT COUNT(DISTINCT p.`id_product`) AS nb
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
AND p.`show_price` = 1
|
AND p.`show_price` = 1
|
||||||
'.((!$beginning AND !$ending) ? ' AND p.`id_product` IN('.((is_array($ids_product) AND count($ids_product)) ? implode(', ', array_map('intval', $ids_product)) : 0).')' : '').'
|
'.((!$beginning AND !$ending) ? ' AND p.`id_product` IN('.((is_array($ids_product) AND count($ids_product)) ? implode(', ', array_map('intval', $ids_product)) : 0).')' : '').'
|
||||||
@@ -1590,9 +1590,9 @@ class ProductCore extends ObjectModel
|
|||||||
pl.`name`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
pl.`name`, i.`id_image`, il.`legend`, t.`rate`, m.`name` AS manufacturer_name,
|
||||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new
|
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
'.Product::sqlStock('p', 0, false, $context->shop).'
|
'.Product::sqlStock('p', 0, false, $context->shop).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
@@ -1642,7 +1642,7 @@ class ProductCore extends ObjectModel
|
|||||||
$ret = array();
|
$ret = array();
|
||||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT cp.`id_category`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'category_product` cp
|
SELECT cp.`id_category`, cl.`name`, cl.`link_rewrite` FROM `'._DB_PREFIX_.'category_product` cp
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cp.`id_category` = cl.`id_category`'.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cp.`id_category` = cl.`id_category`'.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE cp.`id_product` = '.(int)$id_product.'
|
WHERE cp.`id_product` = '.(int)$id_product.'
|
||||||
AND cl.`id_lang` = '.(int)$id_lang);
|
AND cl.`id_lang` = '.(int)$id_lang);
|
||||||
foreach ($row as $val)
|
foreach ($row as $val)
|
||||||
@@ -1673,7 +1673,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT i.`cover`, i.`id_image`, il.`legend`, i.`position`
|
$sql = 'SELECT i.`cover`, i.`id_image`, il.`legend`, i.`position`
|
||||||
FROM `'._DB_PREFIX_.'image` i
|
FROM `'._DB_PREFIX_.'image` i
|
||||||
'.$context->shop->sqlAsso('image', 'i').'
|
'.$context->shop->addSqlAssociation('image', 'i').'
|
||||||
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
WHERE i.`id_product` = '.(int)$this->id.'
|
WHERE i.`id_product` = '.(int)$this->id.'
|
||||||
ORDER BY `position`';
|
ORDER BY `position`';
|
||||||
@@ -1692,7 +1692,7 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
$sql = 'SELECT i.`id_image`
|
$sql = 'SELECT i.`id_image`
|
||||||
FROM `'._DB_PREFIX_.'image` i
|
FROM `'._DB_PREFIX_.'image` i
|
||||||
'.$context->shop->sqlAsso('image', 'i').'
|
'.$context->shop->addSqlAssociation('image', 'i').'
|
||||||
WHERE i.`id_product` = '.(int)($id_product).'
|
WHERE i.`id_product` = '.(int)($id_product).'
|
||||||
AND i.`cover` = 1';
|
AND i.`cover` = 1';
|
||||||
return Db::getInstance()->getRow($sql);
|
return Db::getInstance()->getRow($sql);
|
||||||
@@ -2098,7 +2098,7 @@ class ProductCore extends ObjectModel
|
|||||||
else if (is_string($productAttribute))
|
else if (is_string($productAttribute))
|
||||||
$sql->where('stock.id_product_attribute = IFNULL('.pSQL($productAttribute).'.id_product_attribute, 0)');
|
$sql->where('stock.id_product_attribute = IFNULL('.pSQL($productAttribute).'.id_product_attribute, 0)');
|
||||||
}
|
}
|
||||||
$sql->where(ltrim($shop->sqlRestriction(Shop::SHARE_STOCK, 'stock'), ' AND '));
|
$sql->where(ltrim($shop->addSqlRestriction(Shop::SHARE_STOCK, 'stock'), ' AND '));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -2112,7 +2112,7 @@ class ProductCore extends ObjectModel
|
|||||||
else if (is_string($productAttribute))
|
else if (is_string($productAttribute))
|
||||||
$sql .= ' AND stock.id_product_attribute = IFNULL('.pSQL($productAttribute).'.id_product_attribute, 0)';
|
$sql .= ' AND stock.id_product_attribute = IFNULL('.pSQL($productAttribute).'.id_product_attribute, 0)';
|
||||||
}
|
}
|
||||||
$sql .= $shop->sqlRestriction(Shop::SHARE_STOCK, 'stock').' ';
|
$sql .= $shop->addSqlRestriction(Shop::SHARE_STOCK, 'stock').' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
return $sql;
|
return $sql;
|
||||||
@@ -2217,7 +2217,7 @@ class ProductCore extends ObjectModel
|
|||||||
FROM '._DB_PREFIX_.'stock_available
|
FROM '._DB_PREFIX_.'stock_available
|
||||||
WHERE id_product = '.$this->id.'
|
WHERE id_product = '.$this->id.'
|
||||||
AND id_product_attribute = '.(int)$id_product_attribute.
|
AND id_product_attribute = '.(int)$id_product_attribute.
|
||||||
$context->shop->sqlRestriction(Shop::SHARE_STOCK);
|
$context->shop->addSqlRestriction(Shop::SHARE_STOCK);
|
||||||
|
|
||||||
self::$cacheStock[$this->id][$id_product_attribute] = (int)Db::getInstance()->getValue($sql);
|
self::$cacheStock[$this->id][$id_product_attribute] = (int)Db::getInstance()->getValue($sql);
|
||||||
}
|
}
|
||||||
@@ -2244,7 +2244,7 @@ class ProductCore extends ObjectModel
|
|||||||
FROM '._DB_PREFIX_.'stock_available
|
FROM '._DB_PREFIX_.'stock_available
|
||||||
WHERE id_product = '.$this->id.'
|
WHERE id_product = '.$this->id.'
|
||||||
AND id_product_attribute = 0'.
|
AND id_product_attribute = 0'.
|
||||||
$context->shop->sqlRestriction(Shop::SHARE_STOCK);
|
$context->shop->addSqlRestriction(Shop::SHARE_STOCK);
|
||||||
return (int)Db::getInstance()->getValue($sql);
|
return (int)Db::getInstance()->getValue($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2268,7 +2268,7 @@ class ProductCore extends ObjectModel
|
|||||||
FROM '._DB_PREFIX_.'stock_available
|
FROM '._DB_PREFIX_.'stock_available
|
||||||
WHERE id_product = '.$this->id.'
|
WHERE id_product = '.$this->id.'
|
||||||
AND id_product_attribute = 0'.
|
AND id_product_attribute = 0'.
|
||||||
$context->shop->sqlRestriction(Shop::SHARE_STOCK);
|
$context->shop->addSqlRestriction(Shop::SHARE_STOCK);
|
||||||
return (int)Db::getInstance()->getValue($sql);
|
return (int)Db::getInstance()->getValue($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2439,8 +2439,8 @@ class ProductCore extends ObjectModel
|
|||||||
$sql = 'SELECT p.`id_product`, p.`reference`, pl.`name`
|
$sql = 'SELECT p.`id_product`, p.`reference`, pl.`name`
|
||||||
FROM `'._DB_PREFIX_.'accessory`
|
FROM `'._DB_PREFIX_.'accessory`
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product`= `id_product_2`)
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product`= `id_product_2`)
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE `id_product_1` = '.(int)$id_product;
|
WHERE `id_product_1` = '.(int)$id_product;
|
||||||
return Db::getInstance()->executeS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
@@ -2461,9 +2461,9 @@ class ProductCore extends ObjectModel
|
|||||||
INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new
|
INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new
|
||||||
FROM `'._DB_PREFIX_.'accessory`
|
FROM `'._DB_PREFIX_.'accessory`
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = `id_product_2`
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = `id_product_2`
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`)
|
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer`= m.`id_manufacturer`)
|
||||||
@@ -2617,8 +2617,8 @@ class ProductCore extends ObjectModel
|
|||||||
$sql->select('p.`id_product`, pl.`name`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.`quantity`');
|
$sql->select('p.`id_product`, pl.`name`, p.`active`, p.`reference`, m.`name` AS manufacturer_name, stock.`quantity`');
|
||||||
$sql->from('category_product cp');
|
$sql->from('category_product cp');
|
||||||
$sql->leftJoin('product p ON p.`id_product` = cp.`id_product`');
|
$sql->leftJoin('product p ON p.`id_product` = cp.`id_product`');
|
||||||
$sql->join($context->shop->sqlAsso('product', 'p'));
|
$sql->join($context->shop->addSqlAssociation('product', 'p'));
|
||||||
$sql->leftJoin('product_lang pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')');
|
$sql->leftJoin('product_lang pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')');
|
||||||
$sql->leftJoin('manufacturer m ON m.`id_manufacturer` = p.`id_manufacturer`');
|
$sql->leftJoin('manufacturer m ON m.`id_manufacturer` = p.`id_manufacturer`');
|
||||||
|
|
||||||
$where = 'pl.`name` LIKE \'%'.pSQL($query).'%\' OR p.`reference` LIKE \'%'.pSQL($query).'%\' OR p.`supplier_reference` LIKE \'%'.pSQL($query).'%\'';
|
$where = 'pl.`name` LIKE \'%'.pSQL($query).'%\' OR p.`reference` LIKE \'%'.pSQL($query).'%\' OR p.`supplier_reference` LIKE \'%'.pSQL($query).'%\'';
|
||||||
@@ -3380,7 +3380,7 @@ class ProductCore extends ObjectModel
|
|||||||
SELECT sm.id_stock_mvt, sm.date_add, sm.quantity, sm.id_order,
|
SELECT sm.id_stock_mvt, sm.date_add, sm.quantity, sm.id_order,
|
||||||
CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) employee, mrl.name reason
|
CONCAT(pl.name, \' \', GROUP_CONCAT(IFNULL(al.name, \'\'), \'\')) product_name, CONCAT(e.lastname, \' \', e.firstname) employee, mrl.name reason
|
||||||
FROM `'._DB_PREFIX_.'stock_mvt` sm
|
FROM `'._DB_PREFIX_.'stock_mvt` sm
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (sm.id_product = pl.id_product AND pl.id_lang = '.(int)$id_lang.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (sm.id_product = pl.id_product AND pl.id_lang = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (sm.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'stock_mvt_reason_lang` mrl ON (sm.id_stock_mvt_reason = mrl.id_stock_mvt_reason AND mrl.id_lang = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = sm.id_employee)
|
LEFT JOIN `'._DB_PREFIX_.'employee` e ON (e.id_employee = sm.id_employee)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = sm.id_product_attribute)
|
LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON (pac.id_product_attribute = sm.id_product_attribute)
|
||||||
@@ -3395,9 +3395,9 @@ class ProductCore extends ObjectModel
|
|||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT pl.`id_lang`, pl.`link_rewrite`, p.`ean13`, cl.`link_rewrite` AS category_rewrite
|
SELECT pl.`id_lang`, pl.`link_rewrite`, p.`ean13`, cl.`link_rewrite` AS category_rewrite
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product`'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'lang` l ON (pl.`id_lang` = l.`id_lang`)
|
LEFT JOIN `'._DB_PREFIX_.'lang` l ON (pl.`id_lang` = l.`id_lang`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = p.`id_category_default` AND cl.`id_lang` = pl.`id_lang`'.Context::getContext()->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = p.`id_category_default` AND cl.`id_lang` = pl.`id_lang`'.Context::getContext()->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE p.`id_product` = '.(int)$id_product.'
|
WHERE p.`id_product` = '.(int)$id_product.'
|
||||||
AND l.`active` = 1
|
AND l.`active` = 1
|
||||||
');
|
');
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class ProductSaleCore
|
|||||||
$sql = 'SELECT COUNT(ps.`id_product`) AS nb
|
$sql = 'SELECT COUNT(ps.`id_product`) AS nb
|
||||||
FROM `'._DB_PREFIX_.'product_sale` ps
|
FROM `'._DB_PREFIX_.'product_sale` ps
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ps.`id_product`
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ps.`id_product`
|
||||||
'.$context->shop->sqlAsso('product', 'p', false).'
|
'.$context->shop->addSqlAssociation('product', 'p', false).'
|
||||||
WHERE p.`active` = 1';
|
WHERE p.`active` = 1';
|
||||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||||
}
|
}
|
||||||
@@ -85,8 +85,8 @@ class ProductSaleCore
|
|||||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new
|
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new
|
||||||
FROM `'._DB_PREFIX_.'product_sale` ps
|
FROM `'._DB_PREFIX_.'product_sale` ps
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
|
||||||
'.$context->shop->sqlAsso('product', 'p', false).'
|
'.$context->shop->addSqlAssociation('product', 'p', false).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`)
|
||||||
@@ -134,11 +134,11 @@ class ProductSaleCore
|
|||||||
$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, i.`id_image`, il.`legend`, ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category
|
$sql = 'SELECT p.id_product, pl.`link_rewrite`, pl.`name`, pl.`description_short`, i.`id_image`, il.`legend`, ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category
|
||||||
FROM `'._DB_PREFIX_.'product_sale` ps
|
FROM `'._DB_PREFIX_.'product_sale` ps
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product`
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = p.`id_category_default` AND cl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = p.`id_category_default` AND cl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
AND p.`id_product` IN (
|
AND p.`id_product` IN (
|
||||||
SELECT cp.`id_product`
|
SELECT cp.`id_product`
|
||||||
|
|||||||
@@ -160,8 +160,8 @@ class ReferrerCore extends ObjectModel
|
|||||||
LEFT JOIN '._DB_PREFIX_.'connections_page cp ON cp.id_connections = c.id_connections
|
LEFT JOIN '._DB_PREFIX_.'connections_page cp ON cp.id_connections = c.id_connections
|
||||||
'.$join.'
|
'.$join.'
|
||||||
WHERE cs.date_add BETWEEN '.ModuleGraph::getDateBetween($employee).'
|
WHERE cs.date_add BETWEEN '.ModuleGraph::getDateBetween($employee).'
|
||||||
'.$shop->sqlRestriction(false, 'rs').'
|
'.$shop->addSqlRestriction(false, 'rs').'
|
||||||
'.$shop->sqlRestriction(false, 'c').'
|
'.$shop->addSqlRestriction(false, 'c').'
|
||||||
AND rc.id_referrer = '.(int)$this->id
|
AND rc.id_referrer = '.(int)$this->id
|
||||||
.$where;
|
.$where;
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||||
@@ -195,9 +195,9 @@ class ReferrerCore extends ObjectModel
|
|||||||
LEFT JOIN '._DB_PREFIX_.'customer cu ON cu.id_customer = g.id_customer
|
LEFT JOIN '._DB_PREFIX_.'customer cu ON cu.id_customer = g.id_customer
|
||||||
'.$join.'
|
'.$join.'
|
||||||
WHERE cu.date_add BETWEEN '.ModuleGraph::getDateBetween($employee).'
|
WHERE cu.date_add BETWEEN '.ModuleGraph::getDateBetween($employee).'
|
||||||
'.$shop->sqlRestriction(false, 'rs').'
|
'.$shop->addSqlRestriction(false, 'rs').'
|
||||||
'.$shop->sqlRestriction(false, 'c').'
|
'.$shop->addSqlRestriction(false, 'c').'
|
||||||
'.$shop->sqlRestriction(Shop::SHARE_CUSTOMER, 'cu').'
|
'.$shop->addSqlRestriction(Shop::SHARE_CUSTOMER, 'cu').'
|
||||||
AND cu.date_add > cs.date_add
|
AND cu.date_add > cs.date_add
|
||||||
AND rc.id_referrer = '.(int)($this->id)
|
AND rc.id_referrer = '.(int)($this->id)
|
||||||
.$where;
|
.$where;
|
||||||
@@ -230,9 +230,9 @@ class ReferrerCore extends ObjectModel
|
|||||||
LEFT JOIN '._DB_PREFIX_.'orders oo ON oo.id_customer = g.id_customer
|
LEFT JOIN '._DB_PREFIX_.'orders oo ON oo.id_customer = g.id_customer
|
||||||
'.$join.'
|
'.$join.'
|
||||||
WHERE oo.invoice_date BETWEEN '.ModuleGraph::getDateBetween($employee).'
|
WHERE oo.invoice_date BETWEEN '.ModuleGraph::getDateBetween($employee).'
|
||||||
'.$shop->sqlRestriction(false, 'rs').'
|
'.$shop->addSqlRestriction(false, 'rs').'
|
||||||
'.$shop->sqlRestriction(false, 'c').'
|
'.$shop->addSqlRestriction(false, 'c').'
|
||||||
'.$shop->sqlRestriction(Shop::SHARE_ORDER, 'oo').'
|
'.$shop->addSqlRestriction(Shop::SHARE_ORDER, 'oo').'
|
||||||
AND oo.date_add > cs.date_add
|
AND oo.date_add > cs.date_add
|
||||||
AND rc.id_referrer = '.(int)($this->id).'
|
AND rc.id_referrer = '.(int)($this->id).'
|
||||||
AND oo.valid = 1'
|
AND oo.valid = 1'
|
||||||
@@ -249,7 +249,7 @@ class ReferrerCore extends ObjectModel
|
|||||||
$sql = 'SELECT COUNT(id_order) AS orders, SUM(total_paid_real / conversion_rate) AS sales
|
$sql = 'SELECT COUNT(id_order) AS orders, SUM(total_paid_real / conversion_rate) AS sales
|
||||||
FROM '._DB_PREFIX_.'orders
|
FROM '._DB_PREFIX_.'orders
|
||||||
WHERE id_order IN ('.implode($implode, ',').')
|
WHERE id_order IN ('.implode($implode, ',').')
|
||||||
'.$shop->sqlRestriction(Shop::SHARE_ORDER).'
|
'.$shop->addSqlRestriction(Shop::SHARE_ORDER).'
|
||||||
AND valid = 1';
|
AND valid = 1';
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -214,7 +214,7 @@ class SceneCore extends ObjectModel
|
|||||||
$sql = 'SELECT s.*
|
$sql = 'SELECT s.*
|
||||||
FROM `'._DB_PREFIX_.'scene_category` sc
|
FROM `'._DB_PREFIX_.'scene_category` sc
|
||||||
LEFT JOIN `'._DB_PREFIX_.'scene` s ON (sc.id_scene = s.id_scene)
|
LEFT JOIN `'._DB_PREFIX_.'scene` s ON (sc.id_scene = s.id_scene)
|
||||||
'.$context->shop->sqlAsso('scene', 's').'
|
'.$context->shop->addSqlAssociation('scene', 's').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'scene_lang` sl ON (sl.id_scene = s.id_scene)
|
LEFT JOIN `'._DB_PREFIX_.'scene_lang` sl ON (sl.id_scene = s.id_scene)
|
||||||
WHERE sc.id_category = '.(int)$id_category.'
|
WHERE sc.id_category = '.(int)$id_category.'
|
||||||
AND sl.id_lang = '.(int)$id_lang
|
AND sl.id_lang = '.(int)$id_lang
|
||||||
|
|||||||
+8
-8
@@ -210,7 +210,7 @@ class SearchCore
|
|||||||
INNER JOIN `'._DB_PREFIX_.'category_product` cp ON cp.`id_category` = cg.`id_category`
|
INNER JOIN `'._DB_PREFIX_.'category_product` cp ON cp.`id_category` = cg.`id_category`
|
||||||
INNER JOIN `'._DB_PREFIX_.'category` c ON cp.`id_category` = c.`id_category`
|
INNER JOIN `'._DB_PREFIX_.'category` c ON cp.`id_category` = c.`id_category`
|
||||||
INNER JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product`
|
INNER JOIN `'._DB_PREFIX_.'product` p ON cp.`id_product` = p.`id_product`
|
||||||
'.$context->shop->sqlAsso('product', 'p', false).'
|
'.$context->shop->addSqlAssociation('product', 'p', false).'
|
||||||
WHERE c.`active` = 1
|
WHERE c.`active` = 1
|
||||||
AND p.`active` = 1
|
AND p.`active` = 1
|
||||||
AND indexed = 1
|
AND indexed = 1
|
||||||
@@ -249,8 +249,8 @@ class SearchCore
|
|||||||
$sql = 'SELECT DISTINCT p.id_product, pl.name pname, cl.name cname,
|
$sql = 'SELECT DISTINCT p.id_product, pl.name pname, cl.name cname,
|
||||||
cl.link_rewrite crewrite, pl.link_rewrite prewrite '.$score.'
|
cl.link_rewrite crewrite, pl.link_rewrite prewrite '.$score.'
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('cl').')
|
INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.`id_category_default` = cl.`id_category` AND cl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE p.`id_product` '.$productPool.'
|
WHERE p.`id_product` '.$productPool.'
|
||||||
ORDER BY position DESC LIMIT 10';
|
ORDER BY position DESC LIMIT 10';
|
||||||
return $db->executeS($sql);
|
return $db->executeS($sql);
|
||||||
@@ -259,7 +259,7 @@ class SearchCore
|
|||||||
$sql = 'SELECT p.*, sa.out_of_stock, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
|
$sql = 'SELECT p.*, sa.out_of_stock, pl.`description_short`, pl.`available_now`, pl.`available_later`, pl.`link_rewrite`, pl.`name`,
|
||||||
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name '.$score.', DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 new
|
tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name '.$score.', DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 new
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
AND tr.`id_country` = '.(int)$context->country->id.'
|
AND tr.`id_country` = '.(int)$context->country->id.'
|
||||||
AND tr.`id_state` = 0)
|
AND tr.`id_state` = 0)
|
||||||
@@ -275,7 +275,7 @@ class SearchCore
|
|||||||
|
|
||||||
$sql = 'SELECT COUNT(*)
|
$sql = 'SELECT COUNT(*)
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
AND tr.`id_country` = '.(int)Context::getContext()->country->id.'
|
||||||
AND tr.`id_state` = 0)
|
AND tr.`id_state` = 0)
|
||||||
@@ -552,7 +552,7 @@ class SearchCore
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT COUNT(DISTINCT pt.`id_product`) nb
|
$sql = 'SELECT COUNT(DISTINCT pt.`id_product`) nb
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
'.$context->shop->sqlAsso('product', 'p').'
|
'.$context->shop->addSqlAssociation('product', 'p').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_tag` pt ON (p.`id_product` = pt.`id_product`)
|
LEFT JOIN `'._DB_PREFIX_.'product_tag` pt ON (p.`id_product` = pt.`id_product`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tag` t ON (pt.`id_tag` = t.`id_tag` AND t.`id_lang` = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'tag` t ON (pt.`id_tag` = t.`id_tag` AND t.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = p.`id_product`)
|
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = p.`id_product`)
|
||||||
@@ -568,8 +568,8 @@ class SearchCore
|
|||||||
$sql = 'SELECT DISTINCT p.*, sa.out_of_stock, pl.`description_short`, pl.`link_rewrite`, pl.`name`, tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position,
|
$sql = 'SELECT DISTINCT p.*, sa.out_of_stock, pl.`description_short`, pl.`link_rewrite`, pl.`name`, tax.`rate`, i.`id_image`, il.`legend`, m.`name` manufacturer_name, 1 position,
|
||||||
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 new
|
DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 new
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->sqlLang('pl').')
|
INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
'.$context->shop->sqlAsso('product', 'p', false).'
|
'.$context->shop->addSqlAssociation('product', 'p', false).'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
|
|||||||
@@ -217,7 +217,7 @@ class SupplierCore extends ObjectModel
|
|||||||
$sql = 'SELECT p.*, sa.out_of_stock, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, s.`name` AS supplier_name, tl.`name` AS tax_name, t.`rate`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new,
|
$sql = 'SELECT p.*, sa.out_of_stock, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, i.`id_image`, il.`legend`, s.`name` AS supplier_name, tl.`name` AS tax_name, t.`rate`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new,
|
||||||
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice, m.`name` AS manufacturer_name
|
(p.`price` * ((100 + (t.`rate`))/100)) AS orderprice, m.`name` AS manufacturer_name
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (p.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||||
|
|||||||
+1
-1
@@ -174,7 +174,7 @@ class TagCore extends ObjectModel
|
|||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT pl.name, pl.id_product
|
SELECT pl.name, pl.id_product
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.id_product = pl.id_product'.$context->shop->sqlLang('pl').'
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.id_product = pl.id_product'.$context->shop->addSqlRestrictionOnLang('pl').'
|
||||||
WHERE pl.id_lang = '.(int)$id_lang.'
|
WHERE pl.id_lang = '.(int)$id_lang.'
|
||||||
AND p.active = 1
|
AND p.active = 1
|
||||||
'.($this->id ? ('AND p.id_product '.$in.' (SELECT pt.id_product FROM `'._DB_PREFIX_.'product_tag` pt WHERE pt.id_tag = '.(int)$this->id.')') : '').'
|
'.($this->id ? ('AND p.id_product '.$in.' (SELECT pt.id_product FROM `'._DB_PREFIX_.'product_tag` pt WHERE pt.id_tag = '.(int)$this->id.')') : '').'
|
||||||
|
|||||||
+3
-3
@@ -638,7 +638,7 @@ class ToolsCore
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short`
|
$sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description_short`
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`'.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product`'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE pl.id_lang = '.(int)$id_lang.'
|
WHERE pl.id_lang = '.(int)$id_lang.'
|
||||||
AND pl.id_product = '.(int)$id_product.'
|
AND pl.id_product = '.(int)$id_product.'
|
||||||
AND p.active = 1';
|
AND p.active = 1';
|
||||||
@@ -658,7 +658,7 @@ class ToolsCore
|
|||||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||||
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
|
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
|
||||||
FROM `'._DB_PREFIX_.'category_lang` cl
|
FROM `'._DB_PREFIX_.'category_lang` cl
|
||||||
WHERE cl.`id_lang` = '.(int)($id_lang).' AND cl.`id_category` = '.(int)$id_category.Context::getContext()->shop->sqlLang('cl'));
|
WHERE cl.`id_lang` = '.(int)($id_lang).' AND cl.`id_category` = '.(int)$id_category.Context::getContext()->shop->addSqlRestrictionOnLang('cl'));
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
if (empty($row['meta_description']))
|
if (empty($row['meta_description']))
|
||||||
@@ -848,7 +848,7 @@ class ToolsCore
|
|||||||
{
|
{
|
||||||
$sql = 'SELECT c.id_category, cl.name, cl.link_rewrite
|
$sql = 'SELECT c.id_category, cl.name, cl.link_rewrite
|
||||||
FROM '._DB_PREFIX_.'category c
|
FROM '._DB_PREFIX_.'category c
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE c.nleft <= '.$interval['nleft'].'
|
WHERE c.nleft <= '.$interval['nleft'].'
|
||||||
AND c.nright >= '.$interval['nright'].'
|
AND c.nright >= '.$interval['nright'].'
|
||||||
AND c.nleft >= '.$intervalRoot['nleft'].'
|
AND c.nleft >= '.$intervalRoot['nleft'].'
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class ShopCore extends ObjectModel
|
|||||||
'module_currency' => array('type' => 'fk_shop'),
|
'module_currency' => array('type' => 'fk_shop'),
|
||||||
'module_country' => array('type' => 'fk_shop'),
|
'module_country' => array('type' => 'fk_shop'),
|
||||||
'module_group' => array('type' => 'fk_shop'),
|
'module_group' => array('type' => 'fk_shop'),
|
||||||
'stock' => array('type' => 'fk_shop', 'primary' => 'id_stock'),
|
//'stock' => array('type' => 'fk_shop', 'primary' => 'id_stock'),
|
||||||
'product' => array('type' => 'shop'),
|
'product' => array('type' => 'shop'),
|
||||||
'product_lang' => array('type' => 'fk_shop'),
|
'product_lang' => array('type' => 'fk_shop'),
|
||||||
'referrer' => array('type' => 'shop'),
|
'referrer' => array('type' => 'shop'),
|
||||||
@@ -163,12 +163,12 @@ class ShopCore extends ObjectModel
|
|||||||
foreach (Shop::getAssoTables() as $table_name => $row)
|
foreach (Shop::getAssoTables() as $table_name => $row)
|
||||||
{
|
{
|
||||||
// Special case for stock if current shop is in a share stock group
|
// Special case for stock if current shop is in a share stock group
|
||||||
if ($table_name == 'stock')
|
/*if ($table_name == 'stock')
|
||||||
{
|
{
|
||||||
$group = new GroupShop($this->id_group_shop);
|
$group = new GroupShop($this->id_group_shop);
|
||||||
if ($group->share_stock && $group->getTotalShops() > 1)
|
if ($group->share_stock && $group->getTotalShops() > 1)
|
||||||
continue;
|
continue;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
$id = 'id_'.$row['type'];
|
$id = 'id_'.$row['type'];
|
||||||
if ($row['type'] == 'fk_shop')
|
if ($row['type'] == 'fk_shop')
|
||||||
@@ -647,7 +647,7 @@ class ShopCore extends ObjectModel
|
|||||||
* @param string $alias
|
* @param string $alias
|
||||||
* @param string $type shop|group_shop
|
* @param string $type shop|group_shop
|
||||||
*/
|
*/
|
||||||
public function sqlRestriction($share = false, $alias = null, $type = 'shop')
|
public function addSqlRestriction($share = false, $alias = null, $type = 'shop')
|
||||||
{
|
{
|
||||||
if ($type != 'shop' && $type != 'group_shop')
|
if ($type != 'shop' && $type != 'group_shop')
|
||||||
$type = 'shop';
|
$type = 'shop';
|
||||||
@@ -686,7 +686,7 @@ class ShopCore extends ObjectModel
|
|||||||
* @param Context $context
|
* @param Context $context
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function sqlAsso($table, $alias, $inner_join = true)
|
public function addSqlAssociation($table, $alias, $inner_join = true)
|
||||||
{
|
{
|
||||||
$table_alias = ' asso_shop_'.$table;
|
$table_alias = ' asso_shop_'.$table;
|
||||||
if (strpos($table, '.') !== false)
|
if (strpos($table, '.') !== false)
|
||||||
@@ -709,7 +709,7 @@ class ShopCore extends ObjectModel
|
|||||||
* @param Context $context
|
* @param Context $context
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function sqlLang($alias = null)
|
public function addSqlRestrictionOnLang($alias = null)
|
||||||
{
|
{
|
||||||
return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$this->getID(true).' ';
|
return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$this->getID(true).' ';
|
||||||
}
|
}
|
||||||
@@ -745,12 +745,12 @@ class ShopCore extends ObjectModel
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
// Special case for stock if current shop is in a share stock group
|
// Special case for stock if current shop is in a share stock group
|
||||||
if ($table_name == 'stock')
|
/*if ($table_name == 'stock')
|
||||||
{
|
{
|
||||||
$group = new GroupShop($this->id_group_shop);
|
$group = new GroupShop($this->id_group_shop);
|
||||||
if ($group->share_stock && $group->haveShops())
|
if ($group->share_stock && $group->haveShops())
|
||||||
continue;
|
continue;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
$id = 'id_'.$row['type'];
|
$id = 'id_'.$row['type'];
|
||||||
if ($row['type'] == 'fk_shop')
|
if ($row['type'] == 'fk_shop')
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class AdminTrackingController extends AdminController
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$this->context->language->id.')
|
LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON (a.`id_attribute` = al.`id_attribute` AND al.`id_lang` = '.(int)$this->context->language->id.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$this->context->language->id.')
|
LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.(int)$this->context->language->id.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`)
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = pa.`id_product`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
'.Product::sqlStock('p', 'pa').'
|
'.Product::sqlStock('p', 'pa').'
|
||||||
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`)
|
LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (p.`id_manufacturer` = m.`id_manufacturer`)
|
||||||
WHERE stock.quantity <= 0
|
WHERE stock.quantity <= 0
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class StoresControllerCore extends FrontController
|
|||||||
$stores = Db::getInstance()->executeS('
|
$stores = Db::getInstance()->executeS('
|
||||||
SELECT s.*, cl.name country, st.iso_code state
|
SELECT s.*, cl.name country, st.iso_code state
|
||||||
FROM '._DB_PREFIX_.'store s
|
FROM '._DB_PREFIX_.'store s
|
||||||
'.$this->context->shop->sqlAsso('shop', 's').'
|
'.$this->context->shop->addSqlAssociation('shop', 's').'
|
||||||
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
||||||
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
||||||
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id);
|
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id);
|
||||||
@@ -118,7 +118,7 @@ class StoresControllerCore extends FrontController
|
|||||||
$stores = Db::getInstance()->executeS('
|
$stores = Db::getInstance()->executeS('
|
||||||
SELECT s.*, cl.name country, st.iso_code state
|
SELECT s.*, cl.name country, st.iso_code state
|
||||||
FROM '._DB_PREFIX_.'store s
|
FROM '._DB_PREFIX_.'store s
|
||||||
'.$this->context->shop->sqlAsso('shop', 's').'
|
'.$this->context->shop->addSqlAssociation('shop', 's').'
|
||||||
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
||||||
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
||||||
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id);
|
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id);
|
||||||
@@ -141,7 +141,7 @@ class StoresControllerCore extends FrontController
|
|||||||
) distance,
|
) distance,
|
||||||
cl.id_country id_country
|
cl.id_country id_country
|
||||||
FROM '._DB_PREFIX_.'store s
|
FROM '._DB_PREFIX_.'store s
|
||||||
'.$this->context->shop->sqlAsso('shop', 's').'
|
'.$this->context->shop->addSqlAssociation('shop', 's').'
|
||||||
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
LEFT JOIN '._DB_PREFIX_.'country_lang cl ON (cl.id_country = s.id_country)
|
||||||
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
LEFT JOIN '._DB_PREFIX_.'state st ON (st.id_state = s.id_state)
|
||||||
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id.'
|
WHERE s.active = 1 AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ class BlockCategories extends Module
|
|||||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
||||||
WHERE (c.`active` = 1 OR c.`id_category` = 1)
|
WHERE (c.`active` = 1 OR c.`id_category` = 1)
|
||||||
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
|
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
|
||||||
@@ -232,7 +232,7 @@ class BlockCategories extends Module
|
|||||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
||||||
WHERE (c.`active` = 1 OR c.`id_category` = 1)
|
WHERE (c.`active` = 1 OR c.`id_category` = 1)
|
||||||
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
|
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
|
||||||
|
|||||||
@@ -104,10 +104,10 @@ class BlockViewed extends Module
|
|||||||
$productsImages = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
$productsImages = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||||
SELECT i.id_image, p.id_product, il.legend, p.active, pl.name, pl.description_short, pl.link_rewrite, cl.link_rewrite AS category_rewrite
|
SELECT i.id_image, p.id_product, il.legend, p.active, pl.name, pl.description_short, pl.link_rewrite, cl.link_rewrite AS category_rewrite
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1)
|
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 (il.id_image = i.id_image)
|
LEFT JOIN '._DB_PREFIX_.'image_lang il ON (il.id_image = i.id_image)
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE p.id_product IN ('.$productIds.')
|
WHERE p.id_product IN ('.$productIds.')
|
||||||
AND pl.id_lang = '.(int)($params['cookie']->id_lang).'
|
AND pl.id_lang = '.(int)($params['cookie']->id_lang).'
|
||||||
AND cl.id_lang = '.(int)($params['cookie']->id_lang)
|
AND cl.id_lang = '.(int)($params['cookie']->id_lang)
|
||||||
|
|||||||
@@ -250,9 +250,9 @@ class WishList extends ObjectModel
|
|||||||
SELECT wp.`id_product`, wp.`quantity`, p.`quantity` AS product_quantity, pl.`name`, wp.`id_product_attribute`, wp.`priority`, pl.link_rewrite, cl.link_rewrite AS category_rewrite
|
SELECT wp.`id_product`, wp.`quantity`, p.`quantity` AS product_quantity, pl.`name`, wp.`id_product_attribute`, wp.`priority`, pl.link_rewrite, cl.link_rewrite AS category_rewrite
|
||||||
FROM `'._DB_PREFIX_.'wishlist_product` wp
|
FROM `'._DB_PREFIX_.'wishlist_product` wp
|
||||||
JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = wp.`id_product`
|
JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = wp.`id_product`
|
||||||
JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = wp.`id_product`'.Context::getContext()->shop->sqlLang('pl').'
|
JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = wp.`id_product`'.Context::getContext()->shop->addSqlRestrictionOnLang('pl').'
|
||||||
JOIN `'._DB_PREFIX_.'wishlist` w ON w.`id_wishlist` = wp.`id_wishlist`
|
JOIN `'._DB_PREFIX_.'wishlist` w ON w.`id_wishlist` = wp.`id_wishlist`
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON cl.`id_category` = p.`id_category_default` AND cl.id_lang='.(int)$id_lang.Context::getContext()->shop->sqlLang('cl').'
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON cl.`id_category` = p.`id_category_default` AND cl.id_lang='.(int)$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('cl').'
|
||||||
WHERE w.`id_customer` = '.(int)($id_customer).'
|
WHERE w.`id_customer` = '.(int)($id_customer).'
|
||||||
AND pl.`id_lang` = '.(int)($id_lang).'
|
AND pl.`id_lang` = '.(int)($id_lang).'
|
||||||
AND wp.`id_wishlist` = '.(int)($id_wishlist).
|
AND wp.`id_wishlist` = '.(int)($id_wishlist).
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ class CanadaPost extends CarrierModule
|
|||||||
$categories = Db::getInstance()->executeS('
|
$categories = Db::getInstance()->executeS('
|
||||||
SELECT c.id_category, cl.name, cl.link_rewrite
|
SELECT c.id_category, cl.name, cl.link_rewrite
|
||||||
FROM '._DB_PREFIX_.'category c
|
FROM '._DB_PREFIX_.'category c
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$this->context->language->id.'
|
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||||
ORDER BY c.level_depth ASC
|
ORDER BY c.level_depth ASC
|
||||||
LIMIT '.(int)($category['level_depth'] + 1));
|
LIMIT '.(int)($category['level_depth'] + 1));
|
||||||
@@ -1015,7 +1015,7 @@ class CanadaPost extends CarrierModule
|
|||||||
<option value="0">'.$this->l('Select a product ...').'</option>';
|
<option value="0">'.$this->l('Select a product ...').'</option>';
|
||||||
$productsList = Db::getInstance()->executeS('
|
$productsList = Db::getInstance()->executeS('
|
||||||
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
ORDER BY pl.`name`');
|
ORDER BY pl.`name`');
|
||||||
foreach ($productsList as $product)
|
foreach ($productsList as $product)
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ class CrossSelling extends Module
|
|||||||
SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, p.show_price, cl.link_rewrite category, p.ean13
|
SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, p.show_price, cl.link_rewrite category, p.ean13
|
||||||
FROM '._DB_PREFIX_.'order_detail od
|
FROM '._DB_PREFIX_.'order_detail od
|
||||||
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id)
|
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id)
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id)
|
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id)
|
||||||
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.'
|
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||||
AND od.product_id NOT IN ('.$list_product_ids.') AND i.cover = 1 AND p.active = 1
|
AND od.product_id NOT IN ('.$list_product_ids.') AND i.cover = 1 AND p.active = 1
|
||||||
@@ -190,8 +190,8 @@ class CrossSelling extends Module
|
|||||||
SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, p.show_price, cl.link_rewrite category, p.ean13
|
SELECT DISTINCT od.product_id, pl.name, pl.link_rewrite, p.reference, i.id_image, p.show_price, cl.link_rewrite category, p.ean13
|
||||||
FROM '._DB_PREFIX_.'order_detail od
|
FROM '._DB_PREFIX_.'order_detail od
|
||||||
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id)
|
LEFT JOIN '._DB_PREFIX_.'product p ON (p.id_product = od.product_id)
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id)
|
LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id)
|
||||||
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.'
|
WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||||
AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1
|
AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1
|
||||||
|
|||||||
@@ -1044,14 +1044,14 @@ class Ebay extends Module
|
|||||||
$categoryConfigListTmp = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'ebay_category_configuration`');
|
$categoryConfigListTmp = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'ebay_category_configuration`');
|
||||||
foreach ($categoryConfigListTmp as $c)
|
foreach ($categoryConfigListTmp as $c)
|
||||||
$categoryConfigList[$c['id_category']] = $c;
|
$categoryConfigList[$c['id_category']] = $c;
|
||||||
$categoryList = Db::getInstance()->executeS('SELECT `id_category`, `name` FROM `'._DB_PREFIX_.'category_lang` WHERE `id_lang` = '.(int)$this->id_lang.$this->context->shop->sqlLang('cl'));
|
$categoryList = Db::getInstance()->executeS('SELECT `id_category`, `name` FROM `'._DB_PREFIX_.'category_lang` WHERE `id_lang` = '.(int)$this->id_lang.$this->context->shop->addSqlRestrictionOnLang('cl'));
|
||||||
|
|
||||||
foreach ($categoryList as $k => $c)
|
foreach ($categoryList as $k => $c)
|
||||||
if (!isset($categoryConfigList[$c['id_category']]))
|
if (!isset($categoryConfigList[$c['id_category']]))
|
||||||
{
|
{
|
||||||
$productTest = Db::getInstance()->getRow('
|
$productTest = Db::getInstance()->getRow('
|
||||||
SELECT pl.`name`, pl.`description`
|
SELECT pl.`name`, pl.`description`
|
||||||
FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->id_lang.$this->context->shop->sqlLang('pl').')
|
FROM `'._DB_PREFIX_.'product` p LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->id_lang.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE `id_category_default` = '.(int)$c['id_category']);
|
WHERE `id_category_default` = '.(int)$c['id_category']);
|
||||||
$id_category_ref_suggested = $ebay->getSuggestedCategories($c['name'].' '.$productTest['name']);
|
$id_category_ref_suggested = $ebay->getSuggestedCategories($c['name'].' '.$productTest['name']);
|
||||||
$id_ebay_category_suggested = Db::getInstance()->getValue('SELECT `id_ebay_category` FROM `'._DB_PREFIX_.'ebay_category` WHERE `id_category_ref` = '.(int)$id_category_ref_suggested);
|
$id_ebay_category_suggested = Db::getInstance()->getValue('SELECT `id_ebay_category` FROM `'._DB_PREFIX_.'ebay_category` WHERE `id_category_ref` = '.(int)$id_category_ref_suggested);
|
||||||
|
|||||||
@@ -75,12 +75,12 @@ class FavoriteProduct extends ObjectModel
|
|||||||
SELECT fp.`id_shop`, p.`id_product`, pl.`description_short`, pl.`link_rewrite`, pl.`name`, i.`id_image`, CONCAT(p.`id_product`, \'-\', i.`id_image`) as image
|
SELECT fp.`id_shop`, p.`id_product`, pl.`description_short`, pl.`link_rewrite`, pl.`name`, i.`id_image`, CONCAT(p.`id_product`, \'-\', i.`id_image`) as image
|
||||||
FROM `'._DB_PREFIX_.'favorite_product` fp
|
FROM `'._DB_PREFIX_.'favorite_product` fp
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = fp.`id_product`)
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.`id_product` = fp.`id_product`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.$shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT OUTER JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND `default_on` = 1)
|
LEFT OUTER JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product` AND `default_on` = 1)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product` AND i.`cover` = 1)
|
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_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)($id_lang).')
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
'.$shop->sqlRestriction(false, 'fp'));
|
'.$shop->addSqlRestriction(false, 'fp'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFavoriteProduct($id_customer, $id_product, Shop $shop = null)
|
public static function getFavoriteProduct($id_customer, $id_product, Shop $shop = null)
|
||||||
|
|||||||
@@ -725,7 +725,7 @@ class FedexCarrier extends CarrierModule
|
|||||||
$categories = Db::getInstance()->executeS('
|
$categories = Db::getInstance()->executeS('
|
||||||
SELECT c.id_category, cl.name, cl.link_rewrite
|
SELECT c.id_category, cl.name, cl.link_rewrite
|
||||||
FROM '._DB_PREFIX_.'category c
|
FROM '._DB_PREFIX_.'category c
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$this->context->language->id.'
|
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||||
ORDER BY c.level_depth ASC
|
ORDER BY c.level_depth ASC
|
||||||
LIMIT '.(int)($category['level_depth'] + 1));
|
LIMIT '.(int)($category['level_depth'] + 1));
|
||||||
@@ -1170,7 +1170,7 @@ class FedexCarrier extends CarrierModule
|
|||||||
<option value="0">'.$this->l('Select a product ...').'</option>';
|
<option value="0">'.$this->l('Select a product ...').'</option>';
|
||||||
$productsList = Db::getInstance()->executeS('
|
$productsList = Db::getInstance()->executeS('
|
||||||
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
ORDER BY pl.`name`');
|
ORDER BY pl.`name`');
|
||||||
foreach ($productsList as $product)
|
foreach ($productsList as $product)
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ class MailAlerts extends Module
|
|||||||
$sql = 'SELECT id_product, quantity
|
$sql = 'SELECT id_product, quantity
|
||||||
FROM '._DB_PREFIX_.'stock_available
|
FROM '._DB_PREFIX_.'stock_available
|
||||||
WHERE id_product_attribute = '.(int)$params['id_product_attribute']
|
WHERE id_product_attribute = '.(int)$params['id_product_attribute']
|
||||||
.Context::getContext()->shop->sqlRestriction(Shop::SHARE_STOCK);
|
.Context::getContext()->shop->addSqlRestriction(Shop::SHARE_STOCK);
|
||||||
$result = Db::getInstance()->getRow($sql);
|
$result = Db::getInstance()->getRow($sql);
|
||||||
|
|
||||||
if ($this->_customer_qty AND $result['quantity'] > 0)
|
if ($this->_customer_qty AND $result['quantity'] > 0)
|
||||||
@@ -494,7 +494,7 @@ class MailAlerts extends Module
|
|||||||
$sql = 'SELECT ma.`id_product`, stock.quantity AS product_quantity, pl.`name`, ma.`id_product_attribute`
|
$sql = 'SELECT ma.`id_product`, stock.quantity AS product_quantity, pl.`name`, ma.`id_product_attribute`
|
||||||
FROM `'._DB_PREFIX_.'mailalert_customer_oos` ma
|
FROM `'._DB_PREFIX_.'mailalert_customer_oos` ma
|
||||||
JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ma.`id_product`
|
JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ma.`id_product`
|
||||||
JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = ma.`id_product` AND pl.`id_lang` = '.$id_lang.Context::getContext()->shop->sqlLang('pl').'
|
JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = ma.`id_product` AND pl.`id_lang` = '.$id_lang.Context::getContext()->shop->addSqlRestrictionOnLang('pl').'
|
||||||
'.Product::sqlStock('p', 0).'
|
'.Product::sqlStock('p', 0).'
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
ma.`id_customer` = '.$id_customer;
|
ma.`id_customer` = '.$id_customer;
|
||||||
|
|||||||
@@ -254,7 +254,7 @@ class ProductComment extends ObjectModel
|
|||||||
SELECT pc.`id_product_comment`, pc.`id_product`, IF(c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`
|
SELECT pc.`id_product_comment`, pc.`id_product`, IF(c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`
|
||||||
FROM `'._DB_PREFIX_.'product_comment` pc
|
FROM `'._DB_PREFIX_.'product_comment` pc
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE pc.`validate` = '.(int)$validate.'
|
WHERE pc.`validate` = '.(int)$validate.'
|
||||||
ORDER BY pc.`date_add` DESC'));
|
ORDER BY pc.`date_add` DESC'));
|
||||||
}
|
}
|
||||||
@@ -270,7 +270,7 @@ class ProductComment extends ObjectModel
|
|||||||
SELECT pc.`id_product_comment`, pc.`id_product`, IF(c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`
|
SELECT pc.`id_product_comment`, pc.`id_product`, IF(c.id_customer, CONCAT(c.`firstname`, \' \', c.`lastname`), pc.customer_name) customer_name, pc.`content`, pc.`grade`, pc.`date_add`, pl.`name`
|
||||||
FROM `'._DB_PREFIX_.'product_comment` pc
|
FROM `'._DB_PREFIX_.'product_comment` pc
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
ORDER BY pc.`date_add` DESC'));
|
ORDER BY pc.`date_add` DESC'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -397,7 +397,7 @@ class ProductComment extends ObjectModel
|
|||||||
LEFT JOIN `'._DB_PREFIX_.'product_comment` pc
|
LEFT JOIN `'._DB_PREFIX_.'product_comment` pc
|
||||||
ON pcr.id_product_comment = pc.id_product_comment
|
ON pcr.id_product_comment = pc.id_product_comment
|
||||||
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = pc.`id_customer`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.' AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Context::getContext()->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.' AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Context::getContext()->shop->addSqlRestrictionOnLang('pl').')
|
||||||
ORDER BY pc.`date_add` DESC');
|
ORDER BY pc.`date_add` DESC');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -203,7 +203,7 @@ class Secuvad_flux
|
|||||||
FROM `'._DB_PREFIX_.'secuvad_assoc_category` sac
|
FROM `'._DB_PREFIX_.'secuvad_assoc_category` sac
|
||||||
JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = sac.`id_category`)
|
JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = sac.`id_category`)
|
||||||
JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`)
|
JOIN `'._DB_PREFIX_.'category` c ON (c.`id_category` = cp.`id_category`)
|
||||||
JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`'.$this->context->shop->sqlLang('pl').')
|
JOIN `'._DB_PREFIX_.'product_lang` pl ON (cp.`id_product` = pl.`id_product`'.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = pl.`id_lang` AND l.`id_lang` = '.(int)Context::getContext()->language->id.')
|
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = pl.`id_lang` AND l.`id_lang` = '.(int)Context::getContext()->language->id.')
|
||||||
WHERE pl.`id_product` = '.(int)($product['product_id']).'
|
WHERE pl.`id_product` = '.(int)($product['product_id']).'
|
||||||
ORDER BY c.`level_depth` DESC
|
ORDER BY c.`level_depth` DESC
|
||||||
|
|||||||
@@ -1109,7 +1109,7 @@ class Secuvad extends Module
|
|||||||
$module_not_assoc = Db::getInstance()->executeS('
|
$module_not_assoc = Db::getInstance()->executeS('
|
||||||
SELECT cl.`name`, c.`id_category`
|
SELECT cl.`name`, c.`id_category`
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
FROM `'._DB_PREFIX_.'category` c
|
||||||
JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = c.`id_category`'.$this->context->shop->sqlLang('cl').')
|
JOIN `'._DB_PREFIX_.'category_lang` cl ON (cl.`id_category` = c.`id_category`'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = cl.`id_lang` AND l.`iso_code` = \'en\')
|
JOIN `'._DB_PREFIX_.'lang` l ON (l.`id_lang` = cl.`id_lang` AND l.`iso_code` = \'en\')
|
||||||
JOIN `'._DB_PREFIX_.'secuvad_assoc_category` sac ON (sac.`id_category` = c.`id_category`)
|
JOIN `'._DB_PREFIX_.'secuvad_assoc_category` sac ON (sac.`id_category` = c.`id_category`)
|
||||||
LEFT JOIN `'._DB_PREFIX_.'secuvad_category` sc ON (sc.`category_id` = sac.`category_id` AND sc.`id_lang` = '.(int)$this->context->language->id.')
|
LEFT JOIN `'._DB_PREFIX_.'secuvad_category` sc ON (sc.`category_id` = sac.`category_id` AND sc.`id_lang` = '.(int)$this->context->language->id.')
|
||||||
|
|||||||
@@ -170,8 +170,8 @@ class StatsBestCategories extends ModuleGrid
|
|||||||
AND dr.`time_end` BETWEEN '.$dateBetween.'
|
AND dr.`time_end` BETWEEN '.$dateBetween.'
|
||||||
) AS totalPageViewed
|
) AS totalPageViewed
|
||||||
FROM `'._DB_PREFIX_.'category` ca
|
FROM `'._DB_PREFIX_.'category` ca
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` calang ON (ca.`id_category` = calang.`id_category` AND calang.`id_lang` = '.(int)$id_lang.$this->context->shop->sqlLang('calang').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` calang ON (ca.`id_category` = calang.`id_category` AND calang.`id_lang` = '.(int)$id_lang.$this->context->shop->addSqlRestrictionOnLang('calang').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` parent ON (ca.`id_parent` = parent.`id_category` AND parent.`id_lang` = '.(int)$id_lang.$this->context->shop->sqlLang('parent').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` parent ON (ca.`id_parent` = parent.`id_category` AND parent.`id_lang` = '.(int)$id_lang.$this->context->shop->addSqlRestrictionOnLang('parent').')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_product` capr ON ca.`id_category` = capr.`id_category`
|
LEFT JOIN `'._DB_PREFIX_.'category_product` capr ON ca.`id_category` = capr.`id_category`
|
||||||
LEFT JOIN (
|
LEFT JOIN (
|
||||||
SELECT pr.`id_product`, t.`totalQuantitySold`, t.`totalPriceSold`
|
SELECT pr.`id_product`, t.`totalQuantitySold`, t.`totalPriceSold`
|
||||||
|
|||||||
@@ -164,8 +164,8 @@ class StatsBestProducts extends ModuleGrid
|
|||||||
AND dr.time_end BETWEEN '.$dateBetween.'
|
AND dr.time_end BETWEEN '.$dateBetween.'
|
||||||
) AS totalPageViewed
|
) AS totalPageViewed
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
'.$this->context->shop->sqlAsso('product', 'p').'
|
'.$this->context->shop->addSqlAssociation('product', 'p').'
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->getLang().$this->context->shop->sqlLang('pl').')
|
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->getLang().$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
LEFT JOIN '._DB_PREFIX_.'order_detail od ON od.product_id = p.id_product
|
LEFT JOIN '._DB_PREFIX_.'order_detail od ON od.product_id = p.id_product
|
||||||
LEFT JOIN '._DB_PREFIX_.'orders o ON od.id_order = o.id_order
|
LEFT JOIN '._DB_PREFIX_.'orders o ON od.id_order = o.id_order
|
||||||
WHERE p.active = 1
|
WHERE p.active = 1
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ class StatsCatalog extends Module
|
|||||||
|
|
||||||
$sql = 'SELECT p.id_product, pl.name, pl.link_rewrite
|
$sql = 'SELECT p.id_product, pl.name, pl.link_rewrite
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.id_lang = '.(int)$id_lang.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.id_lang = '.(int)$id_lang.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
'.$this->_join.'
|
'.$this->_join.'
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
'.(sizeof($precalc2) ? 'AND p.`id_product` NOT IN ('.implode(',', $precalc2).')' : '').'
|
'.(sizeof($precalc2) ? 'AND p.`id_product` NOT IN ('.implode(',', $precalc2).')' : '').'
|
||||||
@@ -144,7 +144,7 @@ class StatsCatalog extends Module
|
|||||||
$this->_join = ' LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = p.`id_product`)';
|
$this->_join = ' LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = p.`id_product`)';
|
||||||
$this->_where = ' AND cp.`id_category` = '.$id_category;
|
$this->_where = ' AND cp.`id_category` = '.$id_category;
|
||||||
}
|
}
|
||||||
$this->_join .= $this->context->shop->sqlAsso('product', 'p');
|
$this->_join .= $this->context->shop->addSqlAssociation('product', 'p');
|
||||||
|
|
||||||
$result1 = $this->getQuery1(true);
|
$result1 = $this->getQuery1(true);
|
||||||
$total = $result1['total'];
|
$total = $result1['total'];
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ class StatsCheckUp extends Module
|
|||||||
// Get languages
|
// Get languages
|
||||||
$sql = 'SELECT l.*
|
$sql = 'SELECT l.*
|
||||||
FROM '._DB_PREFIX_.'lang l'
|
FROM '._DB_PREFIX_.'lang l'
|
||||||
.$this->context->shop->sqlAsso('lang', 'l');
|
.$this->context->shop->addSqlAssociation('lang', 'l');
|
||||||
$languages = $db->executeS($sql);
|
$languages = $db->executeS($sql);
|
||||||
|
|
||||||
$arrayColors = array(
|
$arrayColors = array(
|
||||||
@@ -107,7 +107,7 @@ class StatsCheckUp extends Module
|
|||||||
$sql = 'SELECT p.id_product, p.active, pl.name, (
|
$sql = 'SELECT p.id_product, p.active, pl.name, (
|
||||||
SELECT COUNT(*)
|
SELECT COUNT(*)
|
||||||
FROM '._DB_PREFIX_.'image i
|
FROM '._DB_PREFIX_.'image i
|
||||||
'.$this->context->shop->sqlAsso('image', 'i').'
|
'.$this->context->shop->addSqlAssociation('image', 'i').'
|
||||||
WHERE i.id_product = p.id_product
|
WHERE i.id_product = p.id_product
|
||||||
) as nbImages, (
|
) as nbImages, (
|
||||||
SELECT SUM(od.product_quantity)
|
SELECT SUM(od.product_quantity)
|
||||||
@@ -122,8 +122,8 @@ class StatsCheckUp extends Module
|
|||||||
WHERE pa.id_product = p.id_product
|
WHERE pa.id_product = p.id_product
|
||||||
), p.quantity) as stock
|
), p.quantity) as stock
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
'.$this->context->shop->sqlAsso('product', 'p').'
|
'.$this->context->shop->addSqlAssociation('product', 'p').'
|
||||||
ORDER BY '.$orderBy;
|
ORDER BY '.$orderBy;
|
||||||
$result = $db->executeS($sql);
|
$result = $db->executeS($sql);
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ class StatsCheckUp extends Module
|
|||||||
$totals['images'] += (int)$scores['images'];
|
$totals['images'] += (int)$scores['images'];
|
||||||
$totals['sales'] += (int)$scores['sales'];
|
$totals['sales'] += (int)$scores['sales'];
|
||||||
$totals['stock'] += (int)$scores['stock'];
|
$totals['stock'] += (int)$scores['stock'];
|
||||||
$descriptions = $db->executeS('SELECT l.iso_code, pl.description FROM '._DB_PREFIX_.'product_lang pl LEFT JOIN '._DB_PREFIX_.'lang l ON pl.id_lang = l.id_lang WHERE id_product = '.(int)$row['id_product'].$this->context->shop->sqlLang('pl'));
|
$descriptions = $db->executeS('SELECT l.iso_code, pl.description FROM '._DB_PREFIX_.'product_lang pl LEFT JOIN '._DB_PREFIX_.'lang l ON pl.id_lang = l.id_lang WHERE id_product = '.(int)$row['id_product'].$this->context->shop->addSqlRestrictionOnLang('pl'));
|
||||||
foreach ($descriptions as $description)
|
foreach ($descriptions as $description)
|
||||||
{
|
{
|
||||||
$row['desclength_'.$description['iso_code']] = Tools::strlen(strip_tags($description['description']));
|
$row['desclength_'.$description['iso_code']] = Tools::strlen(strip_tags($description['description']));
|
||||||
|
|||||||
@@ -497,7 +497,7 @@ class StatsForecast extends Module
|
|||||||
FROM `'._DB_PREFIX_.'orders` o
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = od.product_id
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.id_product = od.product_id
|
||||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.id_category_default = cl.id_category AND cl.id_lang = '.(int)$this->context->language->id.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.id_category_default = cl.id_category AND cl.id_lang = '.(int)$this->context->language->id.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
'.$join.'
|
'.$join.'
|
||||||
WHERE o.valid = 1
|
WHERE o.valid = 1
|
||||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||||
@@ -510,7 +510,7 @@ class StatsForecast extends Module
|
|||||||
$langValues = '';
|
$langValues = '';
|
||||||
$sql = 'SELECT l.id_lang, l.iso_code
|
$sql = 'SELECT l.id_lang, l.iso_code
|
||||||
FROM `'._DB_PREFIX_.'lang` l
|
FROM `'._DB_PREFIX_.'lang` l
|
||||||
'.$this->context->shop->sqlAsso('lang', 'l').'
|
'.$this->context->shop->addSqlAssociation('lang', 'l').'
|
||||||
WHERE l.active = 1';
|
WHERE l.active = 1';
|
||||||
$languages = Db::getInstance()->executeS($sql);
|
$languages = Db::getInstance()->executeS($sql);
|
||||||
foreach ($languages as $language)
|
foreach ($languages as $language)
|
||||||
|
|||||||
@@ -102,8 +102,8 @@ class StatsProduct extends ModuleGraph
|
|||||||
$sql = 'SELECT p.`id_product`, p.reference, pl.`name`, IFNULL(
|
$sql = 'SELECT p.`id_product`, p.reference, pl.`name`, IFNULL(
|
||||||
(SELECT SUM(pa.quantity) FROM '._DB_PREFIX_.'product_attribute pa WHERE pa.id_product = p.id_product), p.quantity) as quantity
|
(SELECT SUM(pa.quantity) FROM '._DB_PREFIX_.'product_attribute pa WHERE pa.id_product = p.id_product), p.quantity) as quantity
|
||||||
FROM `'._DB_PREFIX_.'product` p
|
FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product`'.$this->context->shop->sqlLang('pl').'
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product`'.$this->context->shop->addSqlRestrictionOnLang('pl').'
|
||||||
'.$this->context->shop->sqlAsso('product', 'p').'
|
'.$this->context->shop->addSqlAssociation('product', 'p').'
|
||||||
'.(Tools::getValue('id_category') ? 'LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`' : '').'
|
'.(Tools::getValue('id_category') ? 'LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON p.`id_product` = cp.`id_product`' : '').'
|
||||||
WHERE pl.`id_lang` = '.(int)($id_lang).'
|
WHERE pl.`id_lang` = '.(int)($id_lang).'
|
||||||
'.(Tools::getValue('id_category') ? 'AND cp.id_category = '.(int)(Tools::getValue('id_category')) : '').'
|
'.(Tools::getValue('id_category') ? 'AND cp.id_category = '.(int)(Tools::getValue('id_category')) : '').'
|
||||||
@@ -128,7 +128,7 @@ class StatsProduct extends ModuleGraph
|
|||||||
$sql = 'SELECT pl.name as pname, pl.id_product, SUM(od.product_quantity) as pqty, AVG(od.product_price) as pprice
|
$sql = 'SELECT pl.name as pname, pl.id_product, SUM(od.product_quantity) as pqty, AVG(od.product_price) as pprice
|
||||||
FROM `'._DB_PREFIX_.'orders` o
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = od.product_id AND pl.id_lang = '.(int)$id_lang.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = od.product_id AND pl.id_lang = '.(int)$id_lang.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE o.id_customer IN (
|
WHERE o.id_customer IN (
|
||||||
SELECT o.id_customer
|
SELECT o.id_customer
|
||||||
FROM `'._DB_PREFIX_.'orders` o
|
FROM `'._DB_PREFIX_.'orders` o
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ class StatsStock extends Module
|
|||||||
FROM '._DB_PREFIX_.'product_attribute pa WHERE p.id_product = pa.id_product
|
FROM '._DB_PREFIX_.'product_attribute pa WHERE p.id_product = pa.id_product
|
||||||
), p.wholesale_price * p.quantity) as stockvalue
|
), p.wholesale_price * p.quantity) as stockvalue
|
||||||
FROM '._DB_PREFIX_.'product p
|
FROM '._DB_PREFIX_.'product p
|
||||||
'.$this->context->shop->sqlAsso('product', 'p').'
|
'.$this->context->shop->addSqlAssociation('product', 'p').'
|
||||||
INNER JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
INNER JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE 1 = 1
|
WHERE 1 = 1
|
||||||
'.$filter;
|
'.$filter;
|
||||||
$products = Db::getInstance()->executeS($sql);
|
$products = Db::getInstance()->executeS($sql);
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ XML;
|
|||||||
$categories = Db::getInstance()->executeS('
|
$categories = Db::getInstance()->executeS('
|
||||||
SELECT cl.name, l.iso_code
|
SELECT cl.name, l.iso_code
|
||||||
FROM '._DB_PREFIX_.'category_product cp
|
FROM '._DB_PREFIX_.'category_product cp
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = cp.id_category'.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = cp.id_category'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
LEFT JOIN '._DB_PREFIX_.'lang l ON (l.id_lang = cl.id_lang)
|
LEFT JOIN '._DB_PREFIX_.'lang l ON (l.id_lang = cl.id_lang)
|
||||||
WHERE cp.id_product = '.(int)$sqlProduct['id_product']);
|
WHERE cp.id_product = '.(int)$sqlProduct['id_product']);
|
||||||
|
|
||||||
|
|||||||
@@ -742,7 +742,7 @@ class UpsCarrier extends CarrierModule
|
|||||||
$categories = Db::getInstance()->executeS('
|
$categories = Db::getInstance()->executeS('
|
||||||
SELECT c.id_category, cl.name, cl.link_rewrite
|
SELECT c.id_category, cl.name, cl.link_rewrite
|
||||||
FROM '._DB_PREFIX_.'category c
|
FROM '._DB_PREFIX_.'category c
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$this->context->language->id.'
|
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$this->context->language->id.'
|
||||||
ORDER BY c.level_depth ASC
|
ORDER BY c.level_depth ASC
|
||||||
LIMIT '.(int)($category['level_depth'] + 1));
|
LIMIT '.(int)($category['level_depth'] + 1));
|
||||||
@@ -1158,7 +1158,7 @@ class UpsCarrier extends CarrierModule
|
|||||||
<option value="0">'.$this->l('Select a product ...').'</option>';
|
<option value="0">'.$this->l('Select a product ...').'</option>';
|
||||||
$productsList = Db::getInstance()->executeS('
|
$productsList = Db::getInstance()->executeS('
|
||||||
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = 2'.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = 2'.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
ORDER BY pl.`name`');
|
ORDER BY pl.`name`');
|
||||||
foreach ($productsList as $product)
|
foreach ($productsList as $product)
|
||||||
|
|||||||
@@ -673,7 +673,7 @@ class UspsCarrier extends CarrierModule
|
|||||||
$categories = Db::getInstance()->executeS('
|
$categories = Db::getInstance()->executeS('
|
||||||
SELECT c.id_category, cl.name, cl.link_rewrite
|
SELECT c.id_category, cl.name, cl.link_rewrite
|
||||||
FROM '._DB_PREFIX_.'category c
|
FROM '._DB_PREFIX_.'category c
|
||||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$this->context->shop->sqlLang('cl').')
|
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||||
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)($this->context->language->id).'
|
WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)($this->context->language->id).'
|
||||||
ORDER BY c.level_depth ASC
|
ORDER BY c.level_depth ASC
|
||||||
LIMIT '.(int)($category['level_depth'] + 1));
|
LIMIT '.(int)($category['level_depth'] + 1));
|
||||||
@@ -1147,7 +1147,7 @@ class UspsCarrier extends CarrierModule
|
|||||||
<option value="0">'.$this->l('Select a product ...').'</option>';
|
<option value="0">'.$this->l('Select a product ...').'</option>';
|
||||||
$productsList = Db::getInstance()->executeS('
|
$productsList = Db::getInstance()->executeS('
|
||||||
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
SELECT pl.* FROM `'._DB_PREFIX_.'product` p
|
||||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->sqlLang('pl').')
|
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||||
WHERE p.`active` = 1
|
WHERE p.`active` = 1
|
||||||
ORDER BY pl.`name`');
|
ORDER BY pl.`name`');
|
||||||
foreach ($productsList as $product)
|
foreach ($productsList as $product)
|
||||||
|
|||||||
Reference in New Issue
Block a user