// Minor changes in BlockCMSModel
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@13782 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
1 parent
a0921c95e9
commit
44c068346f
1 file changed
+31
-32
@@ -361,8 +361,6 @@ class BlockCMSModel extends ObjectModel
|
|||||||
AND c.`active` = 1
|
AND c.`active` = 1
|
||||||
ORDER BY `position`';
|
ORDER BY `position`';
|
||||||
|
|
||||||
// d($sql);
|
|
||||||
|
|
||||||
return Db::getInstance()->executeS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -396,40 +394,41 @@ class BlockCMSModel extends ObjectModel
|
|||||||
return Db::getInstance()->executeS($sql);
|
return Db::getInstance()->executeS($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getCMSCategories($recursive = false, $from = 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;
|
||||||
|
|
||||||
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)$from;
|
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