// Replace shop->addSqlRestriction() and shop->addSqlRestrictionOnLang() by static versions
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13618 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -174,7 +174,7 @@ class BlockCategories extends Module
|
||||
/*p('
|
||||
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
||||
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->addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.Shop::addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (cs.`id_category` = c.`id_category` AND cs.`id_shop` = '.(int)Context::getContext()->shop->id.')
|
||||
WHERE (c.`active` = 1 OR c.`id_category` = 1)
|
||||
@@ -185,7 +185,7 @@ class BlockCategories extends Module
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
||||
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->addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.Shop::addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (cs.`id_category` = c.`id_category`)
|
||||
WHERE (c.`active` = 1 OR c.`id_category` = 1)
|
||||
@@ -259,7 +259,7 @@ class BlockCategories extends Module
|
||||
if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
|
||||
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->addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_lang` = '.$id_lang.Shop::addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
|
||||
WHERE (c.`active` = 1 OR c.`id_category` = 1)
|
||||
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
|
||||
|
||||
@@ -104,10 +104,10 @@ class BlockViewed extends Module
|
||||
$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
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.$this->context->shop->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.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_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->addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.Shop::addSqlRestrictionOnLang('cl').')
|
||||
WHERE p.id_product IN ('.$productIds.')
|
||||
AND pl.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
|
||||
FROM `'._DB_PREFIX_.'wishlist_product` wp
|
||||
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->addSqlRestrictionOnLang('pl').'
|
||||
JOIN `'._DB_PREFIX_.'product_lang` pl ON pl.`id_product` = wp.`id_product`'.Shop::addSqlRestrictionOnLang('pl').'
|
||||
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->addSqlRestrictionOnLang('cl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON cl.`id_category` = p.`id_category_default` AND cl.id_lang='.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
|
||||
WHERE w.`id_customer` = '.(int)($id_customer).'
|
||||
AND pl.`id_lang` = '.(int)($id_lang).'
|
||||
AND wp.`id_wishlist` = '.(int)($id_wishlist).
|
||||
|
||||
@@ -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
|
||||
FROM '._DB_PREFIX_.'order_detail od
|
||||
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->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.Shop::addSqlRestrictionOnLang('cl').')
|
||||
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.'
|
||||
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
|
||||
FROM '._DB_PREFIX_.'order_detail od
|
||||
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->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.$this->context->shop->addSqlRestrictionOnLang('cl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id'.Shop::addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default'.Shop::addSqlRestrictionOnLang('cl').')
|
||||
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.'
|
||||
AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1
|
||||
|
||||
@@ -54,11 +54,8 @@ class FavoriteProduct extends ObjectModel
|
||||
),
|
||||
);
|
||||
|
||||
public static function getFavoriteProducts($id_customer, $id_lang, Shop $shop = null)
|
||||
public static function getFavoriteProducts($id_customer, $id_lang)
|
||||
{
|
||||
if (!$shop)
|
||||
$shop = Context::getContext()->shop;
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
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
|
||||
@@ -67,13 +64,13 @@ class FavoriteProduct extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
|
||||
ON p.`id_product` = pl.`id_product`
|
||||
AND pl.`id_lang` = '.(int)$id_lang
|
||||
.$shop->addSqlRestrictionOnLang('pl').'
|
||||
.Shop::addSqlRestrictionOnLang('pl').'
|
||||
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_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.')
|
||||
WHERE p.`active` = 1
|
||||
'.($id_customer ? ' AND fp.id_customer = '.(int)$id_customer : '').'
|
||||
'.$shop->addSqlRestriction(false, 'fp')
|
||||
'.Shop::addSqlRestriction(false, 'fp')
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class MailAlert extends ObjectModel
|
||||
|
||||
$customer = new Customer($id_customer);
|
||||
$customer_email = $customer->email;
|
||||
$products = MailAlert::getProducts($customer, $id_lang, $shop);
|
||||
$products = MailAlert::getProducts($customer, $id_lang);
|
||||
|
||||
if ((empty($products) === true) || (!sizeof($products)))
|
||||
return array();
|
||||
@@ -195,7 +195,7 @@ class MailAlert extends ObjectModel
|
||||
/*
|
||||
* Get products according to alerts
|
||||
*/
|
||||
public static function getProducts($customer, $id_lang, Shop $shop)
|
||||
public static function getProducts($customer, $id_lang)
|
||||
{
|
||||
$sql = 'SELECT ma.`id_product`, p.`quantity` AS product_quantity, pl.`name`, ma.`id_product_attribute`
|
||||
FROM `'._DB_PREFIX_.self::$definition['table'].'` ma
|
||||
@@ -204,7 +204,7 @@ class MailAlert extends ObjectModel
|
||||
WHERE p.`active` = 1
|
||||
AND (ma.`id_customer` = '.(int)$customer->id.'
|
||||
OR ma.`customer_email` = \''.pSQL($customer->email).'\')
|
||||
AND pl.`id_lang` = '.(int)$id_lang.$shop->addSqlRestriction(false, 'ma');
|
||||
AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestriction(false, 'ma');
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class Pagesnotfound extends Module
|
||||
$sql = 'SELECT http_referer, request_uri, COUNT(*) as nb
|
||||
FROM `'._DB_PREFIX_.'pagenotfound`
|
||||
WHERE date_add BETWEEN '.ModuleGraph::getDateBetween()
|
||||
.$this->sqlShopRestriction().
|
||||
.Shop::addSqlRestriction().
|
||||
'GROUP BY http_referer, request_uri';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
|
||||
@@ -245,7 +245,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`
|
||||
FROM `'._DB_PREFIX_.'product_comment` pc
|
||||
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->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
WHERE pc.`validate` = '.(int)$validate.'
|
||||
ORDER BY pc.`date_add` DESC'));
|
||||
}
|
||||
@@ -261,7 +261,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`
|
||||
FROM `'._DB_PREFIX_.'product_comment` pc
|
||||
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->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = pc.`id_product` AND pl.`id_lang` = '.(int)Context::getContext()->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
ORDER BY pc.`date_add` DESC'));
|
||||
}
|
||||
|
||||
@@ -388,7 +388,7 @@ class ProductComment extends ObjectModel
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_comment` pc
|
||||
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_.'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').')
|
||||
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.Shop::addSqlRestrictionOnLang('pl').')
|
||||
ORDER BY pc.`date_add` DESC');
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ class SEKeywords extends ModuleGraph
|
||||
$this->_query = 'SELECT `keyword`, COUNT(TRIM(`keyword`)) as occurences
|
||||
FROM `'._DB_PREFIX_.'sekeyword`
|
||||
WHERE '.(Configuration::get('SEK_FILTER_KW') == '' ? '1' : '`keyword` REGEXP \''.pSQL(Configuration::get('SEK_FILTER_KW')).'\'')
|
||||
.$this->sqlShopRestriction().
|
||||
.Shop::addSqlRestriction().
|
||||
' AND `date_add` BETWEEN ';
|
||||
|
||||
$this->_query2 = 'GROUP BY TRIM(`keyword`)
|
||||
|
||||
@@ -170,8 +170,8 @@ class StatsBestCategories extends ModuleGrid
|
||||
AND dr.`time_end` BETWEEN '.$dateBetween.'
|
||||
) AS totalPageViewed
|
||||
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->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->addSqlRestrictionOnLang('parent').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` calang ON (ca.`id_category` = calang.`id_category` AND calang.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('calang').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` parent ON (ca.`id_parent` = parent.`id_category` AND parent.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('parent').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` capr ON ca.`id_category` = capr.`id_category`
|
||||
LEFT JOIN (
|
||||
SELECT pr.`id_product`, t.`totalQuantitySold`, t.`totalPriceSold`
|
||||
|
||||
@@ -148,7 +148,7 @@ class StatsBestCustomers extends ModuleGrid
|
||||
LEFT JOIN `'._DB_PREFIX_.'guest` g ON c.`id_customer` = g.`id_customer`
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections` co ON g.`id_guest` = co.`id_guest`
|
||||
WHERE co.date_add BETWEEN '.$this->getDate()
|
||||
.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER, 'c').
|
||||
.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c').
|
||||
'GROUP BY c.`id_customer`, c.`lastname`, c.`firstname`, c.`email`';
|
||||
if (Validate::IsName($this->_sort))
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ class StatsBestManufacturers extends ModuleGrid
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_order = od.id_order)
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
|
||||
WHERE o.invoice_date BETWEEN '.$this->getDate()
|
||||
.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').
|
||||
.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').
|
||||
'AND o.valid = 1
|
||||
AND m.id_manufacturer IS NOT NULL';
|
||||
return Db::getInstance()->getValue($sql);
|
||||
@@ -133,7 +133,7 @@ class StatsBestManufacturers extends ModuleGrid
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON (o.id_order = od.id_order)
|
||||
LEFT JOIN '._DB_PREFIX_.'currency c ON (c.id_currency = o.id_currency)
|
||||
LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer)
|
||||
WHERE '.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
WHERE '.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.invoice_date BETWEEN '.$this->getDate().'
|
||||
AND o.valid = 1
|
||||
AND m.id_manufacturer IS NOT NULL
|
||||
|
||||
@@ -166,7 +166,7 @@ class StatsBestProducts extends ModuleGrid
|
||||
) AS totalPageViewed
|
||||
FROM '._DB_PREFIX_.'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->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->getLang().Shop::addSqlRestrictionOnLang('pl').')
|
||||
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
|
||||
'.Product::sqlStock('p', 0).'
|
||||
|
||||
@@ -119,7 +119,7 @@ class StatsBestSuppliers extends ModuleGrid
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON o.id_order = od.id_order
|
||||
LEFT JOIN '._DB_PREFIX_.'supplier s ON s.id_supplier = p.id_supplier
|
||||
WHERE o.invoice_date BETWEEN '.$this->getDate().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND s.id_supplier IS NOT NULL';
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
@@ -135,7 +135,7 @@ class StatsBestSuppliers extends ModuleGrid
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON o.id_order = od.id_order
|
||||
LEFT JOIN '._DB_PREFIX_.'supplier s ON s.id_supplier = p.id_supplier
|
||||
WHERE o.invoice_date BETWEEN '.$this->getDate().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND s.id_supplier IS NOT NULL
|
||||
GROUP BY p.id_supplier';
|
||||
|
||||
@@ -115,7 +115,7 @@ class StatsBestVouchers extends ModuleGrid
|
||||
FROM '._DB_PREFIX_.'order_cart_rule ocr
|
||||
LEFT JOIN '._DB_PREFIX_.'orders o ON o.id_order = ocr.id_order
|
||||
WHERE o.valid = 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.invoice_date BETWEEN '.$this->getDate().'
|
||||
GROUP BY ocr.id_cart_rule';
|
||||
if (Validate::IsName($this->_sort))
|
||||
|
||||
@@ -59,7 +59,7 @@ class StatsCarrier extends ModuleGraph
|
||||
$sql = 'SELECT COUNT(o.`id_order`) as total
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
WHERE o.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.((int)Tools::getValue('id_order_state') ? 'AND (SELECT oh.id_order_state FROM `'._DB_PREFIX_.'order_history` oh WHERE o.id_order = oh.id_order ORDER BY oh.date_add DESC, oh.id_order_history DESC LIMIT 1) = '.(int)Tools::getValue('id_order_state') : '');
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
$states = OrderState::getOrderStates($this->context->language->id);
|
||||
@@ -102,7 +102,7 @@ class StatsCarrier extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'carrier` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.id_carrier = c.id_carrier
|
||||
WHERE o.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.$stateQuery.'
|
||||
GROUP BY c.`id_carrier`';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
@@ -124,7 +124,7 @@ class StatsCatalog extends Module
|
||||
$sql = 'SELECT p.id_product, pl.name, pl.link_rewrite
|
||||
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->addSqlRestrictionOnLang('pl').')
|
||||
ON (pl.`id_product` = p.`id_product` AND pl.id_lang = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
'.$this->_join.'
|
||||
WHERE p.`active` = 1
|
||||
'.(count($precalc2) ? 'AND p.`id_product` NOT IN ('.implode(',', $precalc2).')' : '').'
|
||||
|
||||
@@ -134,13 +134,13 @@ class StatsCheckUp extends Module
|
||||
LEFT JOIN '._DB_PREFIX_.'order_detail od ON o.id_order = od.id_order
|
||||
WHERE od.product_id = p.id_product
|
||||
AND o.invoice_date BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
) as nbSales,
|
||||
IFNULL(stock.quantity, 0) as stock
|
||||
FROM '._DB_PREFIX_.'product p
|
||||
'.Product::sqlStock('p', 0).'
|
||||
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').')
|
||||
ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
'.$this->context->shop->addSqlAssociation('product', 'p').'
|
||||
ORDER BY '.$orderBy;
|
||||
$result = $db->executeS($sql);
|
||||
@@ -229,7 +229,7 @@ class StatsCheckUp extends Module
|
||||
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'));
|
||||
WHERE id_product = '.(int)$row['id_product'].Shop::addSqlRestrictionOnLang('pl'));
|
||||
foreach ($descriptions as $description)
|
||||
{
|
||||
$row['desclength_'.$description['iso_code']] = Tools::strlen(strip_tags($description['description']));
|
||||
|
||||
@@ -62,7 +62,7 @@ class StatsEquipment extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'connections` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'guest` g ON g.`id_guest` = c.`id_guest`
|
||||
WHERE c.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(false, 'c');
|
||||
'.Shop::addSqlRestriction(false, 'c');
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->query($sql);
|
||||
|
||||
$calcArray = array(
|
||||
@@ -165,7 +165,7 @@ class StatsEquipment extends ModuleGraph
|
||||
LEFT JOIN `'._DB_PREFIX_.'guest` g ON g.`id_web_browser` = wb.`id_web_browser`
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections` c ON g.`id_guest` = c.`id_guest`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction(false, 'c').'
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
AND c.`date_add` BETWEEN ';
|
||||
$this->_query2 = ' GROUP BY g.`id_web_browser`';
|
||||
break;
|
||||
@@ -177,7 +177,7 @@ class StatsEquipment extends ModuleGraph
|
||||
LEFT JOIN `'._DB_PREFIX_.'guest` g ON g.`id_operating_system` = os.`id_operating_system`
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections` c ON g.`id_guest` = c.`id_guest`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction(false, 'c').'
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
AND c.`date_add` BETWEEN ';
|
||||
$this->_query2 = ' GROUP BY g.`id_operating_system`';
|
||||
break;
|
||||
|
||||
@@ -119,7 +119,7 @@ class StatsForecast extends Module
|
||||
LEFT JOIN '._DB_PREFIX_.'product p ON od.product_id = p.id_product
|
||||
WHERE o.valid = 1
|
||||
AND o.invoice_date BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
GROUP BY '.$dateFromGInvoice.'
|
||||
ORDER BY fix_date';
|
||||
$result = $db->query($sql);
|
||||
@@ -157,7 +157,7 @@ class StatsForecast extends Module
|
||||
$sql = 'SELECT '.$dateFromGAdd.' as fix_date, COUNT(*) as visits
|
||||
FROM '._DB_PREFIX_.'connections c
|
||||
WHERE c.date_add BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(false, 'c').'
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
GROUP BY '.$dateFromGAdd;
|
||||
$visits = Db::getInstance()->query($sql);
|
||||
while ($row = $db->nextRow($visits))
|
||||
@@ -170,7 +170,7 @@ class StatsForecast extends Module
|
||||
WHERE o.valid = 1
|
||||
AND o.total_paid_real > 0
|
||||
AND o.invoice_date BETWEEN '.ModuleGraph::getDateBetween()
|
||||
.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
GROUP BY '.$dateFromGInvoice;
|
||||
$discounts = Db::getInstance()->query($sql);
|
||||
while ($row = $db->nextRow($discounts))
|
||||
@@ -188,7 +188,7 @@ class StatsForecast extends Module
|
||||
$sql = 'SELECT COUNT(*) FROM '._DB_PREFIX_.'customer
|
||||
WHERE date_add BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
AND date_add '.$dateFromGReg
|
||||
.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER);
|
||||
.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER);
|
||||
$row['registrations'] = Db::getInstance()->getValue($sql);
|
||||
$totalHT = $row['totalProducts'] - $discountToday;
|
||||
|
||||
@@ -266,7 +266,7 @@ class StatsForecast extends Module
|
||||
$sql = 'SELECT COUNT(DISTINCT c.id_guest)
|
||||
FROM '._DB_PREFIX_.'connections c
|
||||
WHERE c.date_add BETWEEN '.ModuleGraph::getDateBetween()
|
||||
.$this->sqlShopRestriction(false, 'c');
|
||||
.Shop::addSqlRestriction(false, 'c');
|
||||
$visitors = Db::getInstance()->getValue($sql);
|
||||
|
||||
$sql = 'SELECT COUNT(DISTINCT g.id_customer)
|
||||
@@ -274,7 +274,7 @@ class StatsForecast extends Module
|
||||
INNER JOIN '._DB_PREFIX_.'guest g ON c.id_guest = g.id_guest
|
||||
WHERE g.id_customer != 0
|
||||
AND c.date_add BETWEEN '.ModuleGraph::getDateBetween()
|
||||
.$this->sqlShopRestriction(false, 'c');
|
||||
.Shop::addSqlRestriction(false, 'c');
|
||||
$customers = Db::getInstance()->getValue($sql);
|
||||
|
||||
$sql = 'SELECT COUNT(*)
|
||||
@@ -283,7 +283,7 @@ class StatsForecast extends Module
|
||||
SELECT id_cart FROM '._DB_PREFIX_.'cart_product
|
||||
) AND (
|
||||
date_add BETWEEN '.ModuleGraph::getDateBetween().' OR date_upd BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
)'.$this->sqlShopRestriction();
|
||||
)'.Shop::addSqlRestriction();
|
||||
$carts = Db::getInstance()->getValue($sql);
|
||||
|
||||
$sql = 'SELECT COUNT(*)
|
||||
@@ -293,14 +293,14 @@ class StatsForecast extends Module
|
||||
) AND id_address_invoice != 0
|
||||
AND (
|
||||
date_add BETWEEN '.ModuleGraph::getDateBetween().' OR date_upd BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
)'.$this->sqlShopRestriction();
|
||||
)'.Shop::addSqlRestriction();
|
||||
$fullcarts = Db::getInstance()->getValue($sql);
|
||||
|
||||
$sql = 'SELECT COUNT(*)
|
||||
FROM '._DB_PREFIX_.'orders o
|
||||
WHERE o.valid = 1
|
||||
AND o.date_add BETWEEN '.ModuleGraph::getDateBetween()
|
||||
.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o');
|
||||
.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
|
||||
$orders = Db::getInstance()->getValue($sql);
|
||||
|
||||
$this->_html .= '<br />
|
||||
@@ -499,12 +499,12 @@ class StatsForecast extends Module
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
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_.'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').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (p.id_category_default = cl.id_category AND cl.id_lang = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('cl').')
|
||||
'.$join.'
|
||||
WHERE o.valid = 1
|
||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$where.'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
GROUP BY p.id_category_default';
|
||||
$ca['cat'] = Db::getInstance()->executeS($sql);
|
||||
uasort($ca['cat'], 'statsforecast_sort');
|
||||
@@ -525,7 +525,7 @@ class StatsForecast extends Module
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
WHERE o.valid = 1
|
||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o');
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
|
||||
$ca['lang'] = Db::getInstance()->getRow($sql);
|
||||
arsort($ca['lang']);
|
||||
|
||||
@@ -533,7 +533,7 @@ class StatsForecast extends Module
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
WHERE o.valid = 1
|
||||
AND ADDDATE(o.`invoice_date`, interval 30 day) BETWEEN \''.$employee->stats_date_from.' 00:00:00\' AND \''.min(date('Y-m-d H:i:s'), $employee->stats_date_to.' 23:59:59').'\'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o');
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
|
||||
$ca['langprev'] = Db::getInstance()->getRow($sql);
|
||||
}
|
||||
else
|
||||
@@ -548,7 +548,7 @@ class StatsForecast extends Module
|
||||
WHERE o.valid = 1
|
||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$where.'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
GROUP BY o.module
|
||||
ORDER BY total DESC';
|
||||
$ca['payment'] = Db::getInstance()->executeS($sql);
|
||||
@@ -560,7 +560,7 @@ class StatsForecast extends Module
|
||||
LEFT JOIN `'._DB_PREFIX_.'zone` z ON z.id_zone = c.id_zone
|
||||
WHERE o.valid = 1
|
||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
GROUP BY c.id_zone
|
||||
ORDER BY total DESC';
|
||||
$ca['zones'] = Db::getInstance()->executeS($sql);
|
||||
@@ -572,7 +572,7 @@ class StatsForecast extends Module
|
||||
WHERE o.valid = 1
|
||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$where.'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
GROUP BY o.id_currency
|
||||
ORDER BY total DESC';
|
||||
$ca['currencies'] = Db::getInstance()->executeS($sql);
|
||||
@@ -581,7 +581,7 @@ class StatsForecast extends Module
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
WHERE o.valid = 1
|
||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o');
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o');
|
||||
$ca['ventil'] = Db::getInstance()->getRow($sql);
|
||||
|
||||
$sql = 'SELECT /*pac.id_attribute,*/ agl.name as gname, al.name as aname, COUNT(*) as total
|
||||
@@ -593,7 +593,7 @@ class StatsForecast extends Module
|
||||
INNER JOIN '._DB_PREFIX_.'attribute_lang al ON (a.id_attribute = al.id_attribute AND al.id_lang = '.(int)$this->context->language->id.')
|
||||
WHERE o.valid = 1
|
||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
GROUP BY pac.id_attribute';
|
||||
$ca['attributes'] = Db::getInstance()->executeS($sql);
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ class StatsLive extends Module
|
||||
INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
|
||||
INNER JOIN `'._DB_PREFIX_.'customer` u ON u.id_customer = g.id_customer
|
||||
WHERE cp.`time_end` IS NULL
|
||||
'.$this->sqlShopRestriction(false, 'c').'
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
AND TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900
|
||||
GROUP BY c.id_connections
|
||||
ORDER BY u.firstname, u.lastname';
|
||||
@@ -90,7 +90,7 @@ class StatsLive extends Module
|
||||
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON p.id_page_type = pt.id_page_type
|
||||
INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
|
||||
WHERE (g.id_customer IS NULL OR g.id_customer = 0)
|
||||
'.$this->sqlShopRestriction(false, 'c').'
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
AND cp.`time_end` IS NULL
|
||||
AND TIME_TO_SEC(TIMEDIFF(NOW(), cp.`time_start`)) < 900
|
||||
GROUP BY c.id_connections
|
||||
@@ -102,7 +102,7 @@ class StatsLive extends Module
|
||||
FROM `'._DB_PREFIX_.'connections` c
|
||||
INNER JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
|
||||
WHERE (g.id_customer IS NULL OR g.id_customer = 0)
|
||||
'.$this->sqlShopRestriction(false, 'c').'
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
AND TIME_TO_SEC(TIMEDIFF(NOW(), c.`date_add`)) < 900
|
||||
ORDER BY c.date_add DESC';
|
||||
}
|
||||
|
||||
@@ -82,14 +82,14 @@ class StatsNewsletter extends ModuleGraph
|
||||
$sql = 'SELECT COUNT(*) as customers
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `newsletter_date_add` BETWEEN '.ModuleGraph::getDateBetween();
|
||||
$result1 = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
|
||||
$sql = 'SELECT COUNT(*) as visitors
|
||||
FROM '._DB_PREFIX_.'newsletter
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction().'
|
||||
'.Shop::addSqlRestriction().'
|
||||
AND `newsletter_date_add` BETWEEN '.ModuleGraph::getDateBetween();
|
||||
$result2 = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
return array('customers' => $result1['customers'], 'visitors' => $result2['visitors'], 'both' => $result1['customers'] + $result2['visitors']);
|
||||
@@ -105,13 +105,13 @@ class StatsNewsletter extends ModuleGraph
|
||||
$this->_query = 'SELECT newsletter_date_add
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `newsletter_date_add` BETWEEN ';
|
||||
|
||||
$this->_query2 = 'SELECT newsletter_date_add
|
||||
FROM '._DB_PREFIX_.'newsletter
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `newsletter_date_add` BETWEEN ';
|
||||
$this->setDateGraph($layers, true);
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ class StatsOrigin extends ModuleGraph
|
||||
$sql = 'SELECT http_referer
|
||||
FROM '._DB_PREFIX_.'connections
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction().'
|
||||
'.Shop::addSqlRestriction().'
|
||||
AND date_add BETWEEN '.$dateBetween;
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->query($sql);
|
||||
$websites = array($directLink => 0);
|
||||
|
||||
@@ -133,7 +133,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
FROM '._DB_PREFIX_.'customer c
|
||||
LEFT JOIN '._DB_PREFIX_.'gender g ON c.id_gender = g.id_gender
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER, 'c').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'c').'
|
||||
GROUP BY c.id_gender';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
|
||||
@@ -160,7 +160,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
$sql = 'SELECT COUNT(`id_customer`) as total
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) < 18
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `birthday` IS NOT NULL';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (isset($result['total']) && $result['total'])
|
||||
@@ -174,7 +174,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) >= 18
|
||||
AND (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) < 25
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `birthday` IS NOT NULL';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (isset($result['total']) && $result['total'])
|
||||
@@ -188,7 +188,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) >= 25
|
||||
AND (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) < 35
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `birthday` IS NOT NULL';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (isset($result['total']) && $result['total'])
|
||||
@@ -202,7 +202,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) >= 35
|
||||
AND (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) < 50
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `birthday` IS NOT NULL';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (isset($result['total']) && $result['total'])
|
||||
@@ -216,7 +216,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) >= 50
|
||||
AND (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) < 60
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `birthday` IS NOT NULL';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (isset($result['total']) && $result['total'])
|
||||
@@ -229,7 +229,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
$sql = 'SELECT COUNT(`id_customer`) as total
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE (YEAR(CURDATE()) - YEAR(`birthday`)) - (RIGHT(CURDATE(), 5) < RIGHT(`birthday`, 5)) >= 60
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `birthday` IS NOT NULL';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (isset($result['total']) && $result['total'])
|
||||
@@ -242,7 +242,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
$sql = 'SELECT COUNT(`id_customer`) as total
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `birthday` IS NULL
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER);
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if (isset($result['total']) && $result['total'])
|
||||
{
|
||||
@@ -259,7 +259,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
LEFT JOIN `'._DB_PREFIX_.'country` c ON a.`id_country` = c.`id_country`
|
||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` cl ON (c.`id_country` = cl.`id_country` AND cl.`id_lang` = '.(int)$this->context->language->id.')
|
||||
WHERE a.id_customer != 0
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER, 'cu').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER, 'cu').'
|
||||
GROUP BY c.`id_country`';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
foreach ($result as $row)
|
||||
@@ -275,7 +275,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'currency` c ON o.`id_currency` = c.`id_currency`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
GROUP BY c.`id_currency`';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
foreach ($result as $row)
|
||||
@@ -291,7 +291,7 @@ class StatsPersonalInfos extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'lang` c ON o.`id_lang` = c.`id_lang`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
GROUP BY c.`id_lang`';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
foreach ($result as $row)
|
||||
|
||||
@@ -61,7 +61,7 @@ class StatsProduct extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order`
|
||||
WHERE od.`product_id` = '.(int)$id_product.'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND o.`date_add` BETWEEN '.$dateBetween;
|
||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
@@ -74,7 +74,7 @@ class StatsProduct extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order`
|
||||
WHERE od.`product_id` = '.(int)$id_product.'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND o.`date_add` BETWEEN '.$dateBetween;
|
||||
return (float)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
@@ -89,7 +89,7 @@ class StatsProduct extends ModuleGraph
|
||||
LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page`
|
||||
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type`
|
||||
WHERE pt.`name` = \'product\'
|
||||
'.$this->sqlShopRestriction(false, 'pv').'
|
||||
'.Shop::addSqlRestriction(false, 'pv').'
|
||||
AND p.`id_object` = '.(int)$id_product.'
|
||||
AND dr.`time_start` BETWEEN '.$dateBetween.'
|
||||
AND dr.`time_end` BETWEEN '.$dateBetween;
|
||||
@@ -102,7 +102,7 @@ class StatsProduct extends ModuleGraph
|
||||
$sql = 'SELECT p.`id_product`, p.reference, pl.`name`, IFNULL(stock.quantity, 0) as quantity
|
||||
FROM `'._DB_PREFIX_.'product` p
|
||||
'.Product::sqlStock('p', 0).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product`'.$this->context->shop->addSqlRestrictionOnLang('pl').'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product`'.Shop::addSqlRestrictionOnLang('pl').'
|
||||
'.$this->context->shop->addSqlAssociation('product', 'p').'
|
||||
'.(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.'
|
||||
@@ -118,7 +118,7 @@ class StatsProduct extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.id_order = od.id_order
|
||||
WHERE o.date_add BETWEEN '.$this->getDate().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND od.product_id = '.(int)$id_product;
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||
@@ -129,7 +129,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
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
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->addSqlRestrictionOnLang('pl').')
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.id_product = od.product_id AND pl.id_lang = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
|
||||
WHERE o.id_customer IN (
|
||||
SELECT o.id_customer
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
@@ -138,7 +138,7 @@ class StatsProduct extends ModuleGraph
|
||||
AND o.valid = 1
|
||||
AND od.product_id = '.(int)$id_product.'
|
||||
)
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.date_add BETWEEN '.$this->getDate().'
|
||||
AND o.valid = 1
|
||||
AND od.product_id != '.(int)$id_product.'
|
||||
@@ -312,7 +312,7 @@ class StatsProduct extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'order_detail` od
|
||||
LEFT JOIN `'._DB_PREFIX_.'orders` o ON o.`id_order` = od.`id_order`
|
||||
WHERE od.`product_id` = '.(int)$this->_id_product.'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND o.`date_add` BETWEEN '.$dateBetween.'
|
||||
GROUP BY o.`date_add`';
|
||||
@@ -323,7 +323,7 @@ class StatsProduct extends ModuleGraph
|
||||
LEFT JOIN `'._DB_PREFIX_.'page` p ON pv.`id_page` = p.`id_page`
|
||||
LEFT JOIN `'._DB_PREFIX_.'page_type` pt ON pt.`id_page_type` = p.`id_page_type`
|
||||
WHERE pt.`name` = \'product\'
|
||||
'.$this->sqlShopRestriction(false, 'pv').'
|
||||
'.Shop::addSqlRestriction(false, 'pv').'
|
||||
AND p.`id_object` = '.(int)$this->_id_product.'
|
||||
AND dr.`time_start` BETWEEN '.$dateBetween.'
|
||||
AND dr.`time_end` BETWEEN '.$dateBetween.'
|
||||
@@ -335,7 +335,7 @@ class StatsProduct extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON o.`id_order` = od.`id_order`
|
||||
WHERE od.`product_id` = '.(int)$this->_id_product.'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND o.`date_add` BETWEEN '.$dateBetween.'
|
||||
GROUP BY od.`product_attribute_id`';
|
||||
|
||||
@@ -63,7 +63,7 @@ class StatsRegistrations extends ModuleGraph
|
||||
$sql = 'SELECT COUNT(`id_customer`) as total
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE `date_add` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER);
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER);
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
return isset($result['total']) ? $result['total'] : 0;
|
||||
}
|
||||
@@ -80,7 +80,7 @@ class StatsRegistrations extends ModuleGraph
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections` c ON c.id_connections = cp.id_connections
|
||||
LEFT JOIN `'._DB_PREFIX_.'guest` g ON c.id_guest = g.id_guest
|
||||
WHERE pt.name = "authentication"
|
||||
'.$this->sqlShopRestriction(false, 'c').'
|
||||
'.Shop::addSqlRestriction(false, 'c').'
|
||||
AND (g.id_customer IS NULL OR g.id_customer = 0)
|
||||
AND c.`date_add` BETWEEN '.ModuleGraph::getDateBetween();
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
@@ -94,7 +94,7 @@ class StatsRegistrations extends ModuleGraph
|
||||
LEFT JOIN `'._DB_PREFIX_.'guest` g ON o.id_customer = g.id_customer
|
||||
LEFT JOIN `'._DB_PREFIX_.'connections` c ON c.id_guest = g.id_guest
|
||||
WHERE o.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
AND o.valid = 1
|
||||
AND ABS(TIMEDIFF(o.date_add, c.date_add)+0) < 120000';
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
@@ -143,7 +143,7 @@ class StatsRegistrations extends ModuleGraph
|
||||
SELECT `date_add`
|
||||
FROM `'._DB_PREFIX_.'customer`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_CUSTOMER).'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER).'
|
||||
AND `date_add` BETWEEN';
|
||||
$this->_titles['main'] = $this->l('Number of customer accounts created');
|
||||
$this->setDateGraph($layers, true);
|
||||
|
||||
@@ -109,7 +109,7 @@ class StatsSales extends ModuleGraph
|
||||
FROM `'._DB_PREFIX_.'orders` o
|
||||
'.((int)Tools::getValue('id_country') ? 'LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_delivery = a.id_address' : '').'
|
||||
WHERE o.valid = 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.((int)Tools::getValue('id_country') ? 'AND a.id_country = '.(int)Tools::getValue('id_country') : '').'
|
||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween();
|
||||
$result1 = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
@@ -119,7 +119,7 @@ class StatsSales extends ModuleGraph
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON od.`id_order` = o.`id_order`
|
||||
'.((int)Tools::getValue('id_country') ? 'LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_delivery = a.id_address' : '').'
|
||||
WHERE o.valid = 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.((int)Tools::getValue('id_country') ? 'AND a.id_country = '.(int)Tools::getValue('id_country') : '').'
|
||||
AND o.`invoice_date` BETWEEN '.ModuleGraph::getDateBetween();
|
||||
$result2 = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
@@ -158,7 +158,7 @@ class StatsSales extends ModuleGraph
|
||||
LEFT JOIN `'._DB_PREFIX_.'order_detail` od ON od.`id_order` = o.`id_order`
|
||||
'.((int)($this->id_country) ? 'LEFT JOIN `'._DB_PREFIX_.'address` a ON o.id_address_delivery = a.id_address' : '').'
|
||||
WHERE o.valid = 1
|
||||
'.$this->sqlShopRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.Shop::addSqlRestriction(Shop::SHARE_ORDER, 'o').'
|
||||
'.((int)($this->id_country) ? 'AND a.id_country = '.(int)$this->id_country : '').'
|
||||
AND o.`invoice_date` BETWEEN ';
|
||||
$this->_query2 = ' GROUP BY o.id_order';
|
||||
|
||||
@@ -47,7 +47,7 @@ class StatsSearch extends ModuleGraph
|
||||
$this->_query = 'SELECT `keywords`, COUNT(TRIM(`keywords`)) as occurences, MAX(results) as total
|
||||
FROM `'._DB_PREFIX_.'statssearch`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction().'
|
||||
'.Shop::addSqlRestriction().'
|
||||
AND `date_add` BETWEEN ';
|
||||
|
||||
$this->_query2 = 'GROUP BY `keywords`
|
||||
|
||||
@@ -70,7 +70,7 @@ class StatsStock extends Module
|
||||
FROM '._DB_PREFIX_.'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->addSqlRestrictionOnLang('pl').')
|
||||
ON (p.id_product = pl.id_product AND pl.id_lang = '.(int)$this->context->language->id.Shop::addSqlRestrictionOnLang('pl').')
|
||||
'.Product::sqlStock('p', 0).'
|
||||
WHERE 1 = 1
|
||||
'.$filter;
|
||||
|
||||
@@ -59,7 +59,7 @@ class StatsVisits extends ModuleGraph
|
||||
$sql = 'SELECT COUNT(c.`id_connections`)
|
||||
FROM `'._DB_PREFIX_.'connections` c
|
||||
WHERE c.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(false, 'c');
|
||||
'.Shop::addSqlRestriction(false, 'c');
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ class StatsVisits extends ModuleGraph
|
||||
$sql = 'SELECT COUNT(DISTINCT c.`id_guest`)
|
||||
FROM `'._DB_PREFIX_.'connections` c
|
||||
WHERE c.`date_add` BETWEEN '.ModuleGraph::getDateBetween().'
|
||||
'.$this->sqlShopRestriction(false, 'c');
|
||||
'.Shop::addSqlRestriction(false, 'c');
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
@@ -120,12 +120,12 @@ class StatsVisits extends ModuleGraph
|
||||
$this->_query[0] = 'SELECT date_add, COUNT(`date_add`) as total
|
||||
FROM `'._DB_PREFIX_.'connections`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction().'
|
||||
'.Shop::addSqlRestriction().'
|
||||
AND `date_add` BETWEEN ';
|
||||
$this->_query[1] = 'SELECT date_add, COUNT(DISTINCT `id_guest`) as total
|
||||
FROM `'._DB_PREFIX_.'connections`
|
||||
WHERE 1
|
||||
'.$this->sqlShopRestriction().'
|
||||
'.Shop::addSqlRestriction().'
|
||||
AND `date_add` BETWEEN ';
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user