// REVERT MERGE
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7761 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+22
-14
@@ -179,16 +179,6 @@ class CategoryCore extends ObjectModel
|
||||
return $ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see ObjectModel::toggleStatus()
|
||||
*/
|
||||
public function toggleStatus()
|
||||
{
|
||||
$result = parent::toggleStatus();
|
||||
Module::hookExec('categoryUpdate');
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recursive scan of subcategories
|
||||
*
|
||||
@@ -604,19 +594,37 @@ class CategoryCore extends ObjectModel
|
||||
* @param int $id_lang
|
||||
* @return array
|
||||
*/
|
||||
public static function getChildrenWithNbSelectedSubCat($id_parent, $selectedCat, $id_lang)
|
||||
public static function getChildrenWithNbSelectedSubCatForProduct($id_parent, $id_product = 0, $ids_categories = null, $id_lang)
|
||||
{
|
||||
$categories_product_str = '';
|
||||
if ($id_product)
|
||||
{
|
||||
$categories_product = Db::getInstance()->ExecuteS('
|
||||
SELECT `id_category`
|
||||
FROM `'._DB_PREFIX_.'category_product`
|
||||
WHERE `id_product` = '.(int)$id_product);
|
||||
if (sizeof($categories_product))
|
||||
foreach ($categories_product as $category_product)
|
||||
$categories_product_str .= $category_product['id_category'].',';
|
||||
}
|
||||
else
|
||||
{
|
||||
$categories_product = array();
|
||||
$categories_product_str = $ids_categories;
|
||||
}
|
||||
$categories_product_str = rtrim($categories_product_str, ',');
|
||||
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||
SELECT c.`id_category`, c.`level_depth`, cl.`name`, IF((
|
||||
SELECT c.`id_category`, cl.`name`, IF((
|
||||
SELECT COUNT(*)
|
||||
FROM `'._DB_PREFIX_.'category` c2
|
||||
WHERE c2.`id_parent` = c.`id_category`
|
||||
) > 0, 1, 0) AS has_children, '.($selectedCat ? '(
|
||||
) > 0, 1, 0) AS has_children, '.($categories_product_str ? '(
|
||||
SELECT count(c3.`id_category`)
|
||||
FROM `'._DB_PREFIX_.'category` c3
|
||||
WHERE c3.`nleft` > c.`nleft`
|
||||
AND c3.`nright` < c.`nright`
|
||||
AND c3.`id_category` IN ('.$selectedCat.')
|
||||
AND c3.`id_category` IN ('.$categories_product_str.')
|
||||
)' : '0').' AS nbSelectedSubCat
|
||||
FROM `'._DB_PREFIX_.'category` c
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category`
|
||||
|
||||
Reference in New Issue
Block a user