Jump to content
Frank van der Voort

Double categories in footer

Recommended Posts

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)

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

THANK YOU,

this was three days I tried to find this solution.

You are very good guys ... thank you again

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More