Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
Taking care when root_category_ids is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
ecoslado committed Jun 24, 2015
1 parent 7a35cda commit 42866ba
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions dfTools.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ public static function getCategoryPath($id_category, $id_lang, $id_shop, $full =
if (isset(self::$cached_category_paths[$id_category]))
return self::$cached_category_paths[$id_category];

$excluded_ids = implode(',', self::getRootCategoryIds($id_lang));

$sql = "
SELECT
cl.name
Expand All @@ -299,14 +301,15 @@ public static function getCategoryPath($id_category, $id_lang, $id_shop, $full =
AND cl.id_shop = _ID_SHOP_
AND cl.id_lang = _ID_LANG_
AND parent.level_depth <> 0
AND parent.active = 1
AND parent.id_category NOT IN (_EXCLUDED_IDS_)
ORDER BY
AND parent.active = 1 ";

if(count($excluded_ids) > 0 && $excludes_ids[0] != "")
$sql .= "AND parent.id_category NOT IN (_EXCLUDED_IDS_) ";

$sql .= "ORDER BY
parent.nleft
;
";
;";

$excluded_ids = implode(',', self::getRootCategoryIds($id_lang));
$sql = self::prepareSQL($sql, array('_ID_CATEGORY_' => $id_category,
'_ID_SHOP_' => $id_shop,
'_ID_LANG_' => $id_lang,
Expand Down

0 comments on commit 42866ba

Please sign in to comment.