// Merge -> revision 7875
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7877 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+34
-2
@@ -1008,8 +1008,8 @@ class CategoryCore extends ObjectModel
|
||||
|
||||
public function getWsNbProductsRecursive()
|
||||
{
|
||||
$result = Db::getInstance()->ExecuteS(
|
||||
'SELECT count(distinct(id_product)) as nb_product_recursive FROM `'._DB_PREFIX_.'category_product`
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT count(distinct(id_product)) as nb_product_recursive FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE id_category IN (SELECT id_category
|
||||
FROM `'._DB_PREFIX_.'category`
|
||||
WHERE nleft > '.(int)$this->nleft.
|
||||
@@ -1018,5 +1018,37 @@ class CategoryCore extends ObjectModel
|
||||
return -1;
|
||||
return $result[0]['nb_product_recursive'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param Array $ids_category
|
||||
* @param int $id_lang
|
||||
* @return Array
|
||||
*/
|
||||
public static function getCategoryInformations($ids_category, $id_lang = null)
|
||||
{
|
||||
if ($id_lang === null)
|
||||
{
|
||||
global $cookie;
|
||||
$id_lang = $cookie->id_lang;
|
||||
}
|
||||
|
||||
if (!is_array($ids_category) || !sizeof($ids_category))
|
||||
return;
|
||||
|
||||
$categories = array();
|
||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, cl.`id_lang`
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category`)
|
||||
WHERE cl.`id_lang` = '.(int)$id_lang.'
|
||||
AND c.`id_category` IN ('.implode(',', $ids_category).')
|
||||
');
|
||||
|
||||
foreach($results as $category)
|
||||
$categories[$category['id_category']] = $category;
|
||||
|
||||
return $categories;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user