[-] MO : Fix PSCSX-1466 Categorie disapear
This commit is contained in:
+4
-9
@@ -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 = '')
|
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))
|
if (isset($root_category) && !Validate::isInt($root_category))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
@@ -1200,9 +1198,9 @@ class Blocktopmenu extends Module
|
|||||||
SELECT c.*, cl.*
|
SELECT c.*, cl.*
|
||||||
FROM `'._DB_PREFIX_.'category` c
|
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.'")
|
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.'"
|
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 : '').'
|
WHERE 1 '.$sql_filter.' '.($id_lang ? 'AND cl.`id_lang` = '.(int)$id_lang : '').'
|
||||||
'.($active ? ' AND c.`active` = 1' : '').'
|
'.($active ? ' AND (c.`active` = 1 OR c.`is_root_category` = 1)' : '').'
|
||||||
'.(isset($groups) && Group::isFeatureActive() ? ' AND cg.`id_group` IN ('.implode(',', $groups).')' : '').'
|
'.(isset($groups) && Group::isFeatureActive() ? ' AND cg.`id_group` IN ('.implode(',', $groups).')' : '').'
|
||||||
'.(!$id_lang || (isset($groups) && Group::isFeatureActive()) ? ' GROUP BY c.`id_category`' : '').'
|
'.(!$id_lang || (isset($groups) && Group::isFeatureActive()) ? ' GROUP BY c.`id_category`' : '').'
|
||||||
'.($sql_sort != '' ? $sql_sort : ' ORDER BY c.`level_depth` ASC').'
|
'.($sql_sort != '' ? $sql_sort : ' ORDER BY c.`level_depth` ASC').'
|
||||||
@@ -1213,15 +1211,12 @@ class Blocktopmenu extends Module
|
|||||||
$categories = array();
|
$categories = array();
|
||||||
$buff = array();
|
$buff = array();
|
||||||
|
|
||||||
if (!isset($root_category))
|
|
||||||
$root_category = 1;
|
|
||||||
|
|
||||||
foreach ($result as $row)
|
foreach ($result as $row)
|
||||||
{
|
{
|
||||||
$current = &$buff[$row['id_category']];
|
$current = &$buff[$row['id_category']];
|
||||||
$current = $row;
|
$current = $row;
|
||||||
|
|
||||||
if ($row['id_category'] == $root_category)
|
if ($row['id_parent'] == 0)
|
||||||
$categories[$row['id_category']] = &$current;
|
$categories[$row['id_category']] = &$current;
|
||||||
else
|
else
|
||||||
$buff[$row['id_parent']]['children'][$row['id_category']] = &$current;
|
$buff[$row['id_parent']]['children'][$row['id_category']] = &$current;
|
||||||
|
|||||||
Reference in New Issue
Block a user