[-] MO : BugFix : #PSCFV-2566 : Created category does not appear on CMS module configuration (blockcms)
This commit is contained in:
1 parent
962a954d5b
commit
c946e036e4
1 file changed
+33
-31
@@ -394,41 +394,43 @@ class BlockCMSModel extends ObjectModel
|
|||||||
return Db::getInstance()->executeS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCMSCategories($recursive = false, $parent = 0)
|
public static function getCMSCategories($recursive = false, $parent = 0)
|
||||||
{
|
{
|
||||||
if ($recursive === false)
|
if ($recursive === false)
|
||||||
{
|
{
|
||||||
$sql = 'SELECT bcp.`id_cms_category`, bcp.`id_parent`, bcp.`level_depth`, bcp.`active`, bcp.`position`, cl.`name`, cl.`link_rewrite`
|
$sql = 'SELECT bcp.`id_cms_category`, bcp.`id_parent`, bcp.`level_depth`, bcp.`active`, bcp.`position`, cl.`name`, cl.`link_rewrite`
|
||||||
FROM `'._DB_PREFIX_.'cms_category` bcp
|
FROM `'._DB_PREFIX_.'cms_category` bcp
|
||||||
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
|
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
|
||||||
ON (bcp.`id_cms_category` = cl.`id_cms_category`)
|
ON (bcp.`id_cms_category` = cl.`id_cms_category`)
|
||||||
WHERE cl.`id_lang` = '.(int)Context::getContext()->language->id.'
|
WHERE cl.`id_lang` = '.(int)Context::getContext()->language->id;
|
||||||
AND bcp.`id_parent` = '.(int)$parent;
|
if ($parent)
|
||||||
|
$sql .= ' AND bcp.`id_parent` = '.(int)$parent;
|
||||||
|
|
||||||
return Db::getInstance()->executeS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = 'SELECT bcp.`id_cms_category`, bcp.`id_parent`, bcp.`level_depth`, bcp.`active`, bcp.`position`, cl.`name`, cl.`link_rewrite`
|
$sql = 'SELECT bcp.`id_cms_category`, bcp.`id_parent`, bcp.`level_depth`, bcp.`active`, bcp.`position`, cl.`name`, cl.`link_rewrite`
|
||||||
FROM `'._DB_PREFIX_.'cms_category` bcp
|
FROM `'._DB_PREFIX_.'cms_category` bcp
|
||||||
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
|
INNER JOIN `'._DB_PREFIX_.'cms_category_lang` cl
|
||||||
ON (bcp.`id_cms_category` = cl.`id_cms_category`)
|
ON (bcp.`id_cms_category` = cl.`id_cms_category`)
|
||||||
WHERE cl.`id_lang` = '.(int)Context::getContext()->language->id.'
|
WHERE cl.`id_lang` = '.(int)Context::getContext()->language->id;
|
||||||
AND bcp.`id_parent` = '.(int)$parent;
|
if ($parent)
|
||||||
|
$sql .= ' AND bcp.`id_parent` = '.(int)$parent;
|
||||||
|
|
||||||
$results = Db::getInstance()->executeS($sql);
|
$results = Db::getInstance()->executeS($sql);
|
||||||
foreach ($results as $result)
|
foreach ($results as $result)
|
||||||
{
|
{
|
||||||
$sub_categories = BlockCMSModel::getCMSCategories(true, $result['id_cms_category']);
|
$sub_categories = BlockCMSModel::getCMSCategories(true, $result['id_cms_category']);
|
||||||
if ($sub_categories && count($sub_categories) > 0)
|
if ($sub_categories && count($sub_categories) > 0)
|
||||||
$result['sub_categories'] = $sub_categories;
|
$result['sub_categories'] = $sub_categories;
|
||||||
$categories[] = $result;
|
$categories[] = $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
return isset($categories) ? $categories : false;
|
return isset($categories) ? $categories : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get a single CMS block by its ID */
|
/* Get a single CMS block by its ID */
|
||||||
public static function getBlockCMS($id_cms_block)
|
public static function getBlockCMS($id_cms_block)
|
||||||
|
|||||||
Reference in new issue
Block a user