// Fix some bugs on multishop
This commit is contained in:
@@ -33,11 +33,11 @@ class ProductSaleCore
|
||||
*/
|
||||
public static function fillProductSales()
|
||||
{
|
||||
return Db::getInstance()->Execute('
|
||||
REPLACE INTO '._DB_PREFIX_.'product_sale
|
||||
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
||||
SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW()
|
||||
FROM '._DB_PREFIX_.'order_detail od GROUP BY od.product_id');
|
||||
$sql = 'REPLACE INTO '._DB_PREFIX_.'product_sale
|
||||
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
||||
SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW()
|
||||
FROM '._DB_PREFIX_.'order_detail od GROUP BY od.product_id';
|
||||
return Db::getInstance()->Execute($sql);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -51,8 +51,8 @@ class ProductSaleCore
|
||||
|
||||
$sql = 'SELECT COUNT(ps.`id_product`) AS nb
|
||||
FROM `'._DB_PREFIX_.'product_sale` ps
|
||||
'.$context->shop->sqlAsso('product', 'p', false).'
|
||||
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ps.`id_product`
|
||||
'.$context->shop->sqlAsso('product', 'p', false).'
|
||||
WHERE p.`active` = 1';
|
||||
return (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
|
||||
}
|
||||
|
||||
+4
-2
@@ -641,6 +641,8 @@ class ShopCore extends ObjectModel
|
||||
{
|
||||
if ($shopID || $shopGroupID)
|
||||
$restriction = ' AND '.$alias.'id_shop IN ('.implode(', ', $this->getListOfID($share)).') ';
|
||||
else if ($share == Shop::SHARE_STOCK)
|
||||
$restriction = ' AND '.$alias.'id_shop = '.$this->getID(true);
|
||||
}
|
||||
|
||||
return $restriction;
|
||||
@@ -678,9 +680,9 @@ class ShopCore extends ObjectModel
|
||||
* @param Context $context
|
||||
* @return string
|
||||
*/
|
||||
public function sqlLang($alias)
|
||||
public function sqlLang($alias = null)
|
||||
{
|
||||
return ' AND '.$alias.'.id_shop = '.$this->getID(true). ' ';
|
||||
return ' AND '.(($alias) ? $alias.'.' : '').'id_shop = '.$this->getID(true). ' ';
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+6
-4
@@ -655,10 +655,12 @@ class ToolsCore
|
||||
elseif ($id_category = self::getValue('id_category'))
|
||||
{
|
||||
$page_number = self::getValue('p');
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
||||
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
|
||||
FROM `'._DB_PREFIX_.'category_lang`
|
||||
WHERE id_lang = '.(int)($id_lang).' AND id_category = '.(int)$id_category.Context::getContext()->shop->sqlLang());
|
||||
$sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
|
||||
FROM `'._DB_PREFIX_.'category_lang`
|
||||
WHERE id_lang = '.(int)$id_lang.'
|
||||
AND id_category = '.(int)$id_category
|
||||
.Context::getContext()->shop->sqlLang();
|
||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||
if ($row)
|
||||
{
|
||||
if (empty($row['meta_description']))
|
||||
|
||||
Reference in New Issue
Block a user