[-] MO : Fix PSCSX-1466 Categorie disapear

This commit is contained in:
Sacha Froment
2014-10-06 12:24:53 +02:00
parent 7a3c782dec
commit 6d08c207d7
+4 -9
View File
@@ -1180,8 +1180,6 @@ class Blocktopmenu extends Module
public function customGetNestedCategories($shop_id, $root_category = null, $id_lang = false, $active = true, $groups = null, $use_shop_restriction = true, $sql_filter = '', $sql_sort = '', $sql_limit = '')
{
if (isset($root_category) && !Validate::isInt($root_category))
die(Tools::displayError());
@@ -1200,9 +1198,9 @@ class Blocktopmenu extends Module
SELECT c.*, cl.*
FROM `'._DB_PREFIX_.'category` c
INNER JOIN `'._DB_PREFIX_.'category_shop` category_shop ON (category_shop.`id_category` = c.`id_category` AND category_shop.`id_shop` = "'.(int)$shop_id.'")
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON c.`id_category` = cl.`id_category` AND cl.`id_shop` = "'.(int)$shop_id.'"
WHERE 1 '.$sql_filter.' '.($id_lang ? 'AND `id_lang` = '.(int)$id_lang : '').'
'.($active ? ' AND c.`active` = 1' : '').'
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND cl.`id_shop` = "'.(int)$shop_id.'")
WHERE 1 '.$sql_filter.' '.($id_lang ? 'AND cl.`id_lang` = '.(int)$id_lang : '').'
'.($active ? ' AND (c.`active` = 1 OR c.`is_root_category` = 1)' : '').'
'.(isset($groups) && Group::isFeatureActive() ? ' AND cg.`id_group` IN ('.implode(',', $groups).')' : '').'
'.(!$id_lang || (isset($groups) && Group::isFeatureActive()) ? ' GROUP BY c.`id_category`' : '').'
'.($sql_sort != '' ? $sql_sort : ' ORDER BY c.`level_depth` ASC').'
@@ -1213,15 +1211,12 @@ class Blocktopmenu extends Module
$categories = array();
$buff = array();
if (!isset($root_category))
$root_category = 1;
foreach ($result as $row)
{
$current = &$buff[$row['id_category']];
$current = $row;
if ($row['id_category'] == $root_category)
if ($row['id_parent'] == 0)
$categories[$row['id_category']] = &$current;
else
$buff[$row['id_parent']]['children'][$row['id_category']] = &$current;