Jump to content

Double categories in footer


Recommended Posts

  • 1 month later...

Hi all,

 

As in the title the categories that are shown in my footer (block cms) are double. I noticed that it happens when you're logged in to a account. When I log out the categories aren't shown double.

 

Anybody an idea how I can fix this?

 

 

post-341033-0-87810000-1334308967_thumb.png

 

(picture shows double categories when logged in)

 

 

Hi,

 

Just experienced the same in Prestashop new theme. Funny i have not seen it before in 2 month of development.

Just updated to latest version and it is still the same.

Anyone knows about this?

 

//Stefan

Link to comment
Share on other sites

  • 2 weeks later...

This appears to be a bug is PS. Basically the query:

 

SELECT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
FROM `'._DB_PREFIX_.'category` c
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
WHERE (c.`active` = 1 OR c.`id_category` = 1)
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
AND cg.`id_group` IN ('.pSQL($groups).')
ORDER BY `level_depth` ASC, c.`position` ASC

 

Returns a match for every customer group. So if a category is in multiple groups it is returned multiple times. To fix this add the word DISTINCT to the query in public function hookFooter() blockcategories.php

 

SELECT DISTINCT c.id_parent, c.id_category, cl.name, cl.description, cl.link_rewrite
FROM `'._DB_PREFIX_.'category` c
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` AND `id_lang` = '.$id_lang.')
LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = c.`id_category`)
WHERE (c.`active` = 1 OR c.`id_category` = 1)
'.((int)($maxdepth) != 0 ? ' AND `level_depth` <= '.(int)($maxdepth) : '').'
AND cg.`id_group` IN ('.pSQL($groups).')
ORDER BY `level_depth` ASC, c.`position` ASC

 

You may also have to manually clear the smarty cache and compile folders (i.e. delete all files in these folders except index.php) - I advise clearing BOTH smarty and smarty_v2 i.e.

"tools -> smarty->cache" and "tools -> smarty->compile"

"tools -> smarty_v2->cache" and "tools -> smarty_v2->compile"

As if you upgraded from a Smarty v2 theme at some point this seems to prevent the Performance "Force Compile" from clearing the problem.

Edited by markb (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 8 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...