// Fix some bugs on multishop
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8145 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
@@ -33,11 +33,11 @@ class ProductSaleCore
|
|||||||
*/
|
*/
|
||||||
public static function fillProductSales()
|
public static function fillProductSales()
|
||||||
{
|
{
|
||||||
return Db::getInstance()->Execute('
|
$sql = 'REPLACE INTO '._DB_PREFIX_.'product_sale
|
||||||
REPLACE INTO '._DB_PREFIX_.'product_sale
|
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
||||||
(`id_product`, `quantity`, `sale_nbr`, `date_upd`)
|
SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW()
|
||||||
SELECT od.product_id, COUNT(od.product_id), SUM(od.product_quantity), NOW()
|
FROM '._DB_PREFIX_.'order_detail od GROUP BY od.product_id';
|
||||||
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
|
$sql = 'SELECT COUNT(ps.`id_product`) AS nb
|
||||||
FROM `'._DB_PREFIX_.'product_sale` ps
|
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`
|
LEFT JOIN `'._DB_PREFIX_.'product` p ON p.`id_product` = ps.`id_product`
|
||||||
|
'.$context->shop->sqlAsso('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);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-2
@@ -641,6 +641,8 @@ class ShopCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
if ($shopID || $shopGroupID)
|
if ($shopID || $shopGroupID)
|
||||||
$restriction = ' AND '.$alias.'id_shop IN ('.implode(', ', $this->getListOfID($share)).') ';
|
$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;
|
return $restriction;
|
||||||
@@ -678,9 +680,9 @@ class ShopCore extends ObjectModel
|
|||||||
* @param Context $context
|
* @param Context $context
|
||||||
* @return string
|
* @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'))
|
elseif ($id_category = self::getValue('id_category'))
|
||||||
{
|
{
|
||||||
$page_number = self::getValue('p');
|
$page_number = self::getValue('p');
|
||||||
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
|
$sql = 'SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
|
||||||
SELECT `name`, `meta_title`, `meta_description`, `meta_keywords`, `description`
|
FROM `'._DB_PREFIX_.'category_lang`
|
||||||
FROM `'._DB_PREFIX_.'category_lang`
|
WHERE id_lang = '.(int)$id_lang.'
|
||||||
WHERE id_lang = '.(int)($id_lang).' AND id_category = '.(int)$id_category.Context::getContext()->shop->sqlLang());
|
AND id_category = '.(int)$id_category
|
||||||
|
.Context::getContext()->shop->sqlLang();
|
||||||
|
$row = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
|
||||||
if ($row)
|
if ($row)
|
||||||
{
|
{
|
||||||
if (empty($row['meta_description']))
|
if (empty($row['meta_description']))
|
||||||
|
|||||||
Reference in New Issue
Block a user