Frank van der Voort Posted April 13, 2012 Share Posted April 13, 2012 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? (picture shows double categories when logged in) Link to comment Share on other sites More sharing options...
Steppo Posted June 11, 2012 Share Posted June 11, 2012 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? (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 More sharing options...
markb Posted June 22, 2012 Share Posted June 22, 2012 (edited) 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 June 22, 2012 by markb (see edit history) 2 Link to comment Share on other sites More sharing options...
Frank van der Voort Posted June 22, 2012 Author Share Posted June 22, 2012 Thank you markb! I already deleted the blockcategories because I couldn't get it to work properly. I will try this later today and see if it works. Link to comment Share on other sites More sharing options...
marco94310 Posted March 6, 2013 Share Posted March 6, 2013 THANK YOU, this was three days I tried to find this solution. You are very good guys ... thank you again Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now