zero22hero Posted May 9, 2013 Share Posted May 9, 2013 (edited) Hi, I am newbie here My problem was with 'blocktopmenu' module: this module is registered with 'displayTop' hook and in 'header.tpl' of my theme, I call this hook like this: {hook h='displayTop' mod='blocktopmenu'} It works fine but the generated html is duplicated and I dont know why <ul> <li><a> Link 1</a></li> <li><a> Link 2</a></li> <li><a> Link 3</a></li> <li><a> Link 1</a></li> <li><a> Link 2</a></li> <li><a> Link 3</a></li> </ul> Instead of: <ul> <li><a> Link 1</a></li> <li><a> Link 2</a></li> <li><a> Link 3</a></li> </ul> I greatly appreciate your help. Thanks in advance! --------------------------------------------------------------- Update: to understand clearly about this issue, just follow those steps: - Install a new prestashop v 1.5.x - Go to BO, Advanced Parameters -> Performance, change the settings to: Template Cache -> Force Compilation, Cache -> No - Go to \prestashop\themes\default folder, open the header.tpl file, erase all lines of code and replace by: {hook h='displayTop' mod='blocktopmenu'} Now go and check your shop, you will see the menu content repeats twice Edited May 11, 2013 by zero22hero (see edit history) Link to comment Share on other sites More sharing options...
zero22hero Posted May 9, 2013 Author Share Posted May 9, 2013 plz, any help? Link to comment Share on other sites More sharing options...
Paul C Posted May 9, 2013 Share Posted May 9, 2013 All you should need to do is to go to Modules->Positions and remove the module from the "Top of Pages". By default the module inserts its content in there and by using the smarty plugin you're displaying it now twice. 1 Link to comment Share on other sites More sharing options...
zero22hero Posted May 9, 2013 Author Share Posted May 9, 2013 (edited) All you should need to do is to go to Modules->Positions and remove the module from the "Top of Pages". By default the module inserts its content in there and by using the smarty plugin you're displaying it now twice. Hi Paul C, Thanks for your reply. I checked and there's only one 'Top horizontal menu' module at that position Logically, if you try to transplant another 'Top horizontal menu' into that position, it will give an error: " This module has already been transplanted to this hook ", so I can not display it twice by mistake, right? Edited May 9, 2013 by zero22hero (see edit history) Link to comment Share on other sites More sharing options...
zero22hero Posted May 10, 2013 Author Share Posted May 10, 2013 (edited) In 'blocktopmenu.php', I tried to use var_dump on $MENU variable before smarty display the template, it's still correct there But in 'blocktopmenu.tpl', it's showing differently. I dont know what the problem is... Also, I tried to assign raw html to $this->_menu variable like this: $this->_menu = '<li><a href="#">Delivery</a></li> <li><a href="#">Legal Notice</a></li>'; $this->smarty->assign('MENU', $this->_menu); Then, it works fine!!! So, what happened with $this->_menu variable??? Edited May 10, 2013 by zero22hero (see edit history) Link to comment Share on other sites More sharing options...
zero22hero Posted May 10, 2013 Author Share Posted May 10, 2013 Any idea??? Link to comment Share on other sites More sharing options...
vekia Posted May 10, 2013 Share Posted May 10, 2013 you've got default prstashop template or maybe you use some external non-default solution? It's important question, maybe issue is with template code. Let us know 1 Link to comment Share on other sites More sharing options...
zero22hero Posted May 10, 2013 Author Share Posted May 10, 2013 you've got default prstashop template or maybe you use some external non-default solution? It's important question, maybe issue is with template code. Let us know Hi vekia, Thanks for your reply! I'm developing my own theme base on the default one, means I've changed header.tpl, footer.tpl and other template files. Please let me know which issue I am dealing to? Link to comment Share on other sites More sharing options...
vekia Posted May 10, 2013 Share Posted May 10, 2013 but you changed blocktopmenu module files? Link to comment Share on other sites More sharing options...
zero22hero Posted May 10, 2013 Author Share Posted May 10, 2013 but you changed blocktopmenu module files? 'blocktopmenu.tpl'? yes, i did but i did not touch blocktopmenu.php file Link to comment Share on other sites More sharing options...
vekia Posted May 10, 2013 Share Posted May 10, 2013 you pasted above something like: <ul> <li><a> Link 1</a></li> <li><a> Link 2</a></li> <li><a> Link 3</a></li> <li><a> Link 1</a></li> <li><a> Link 2</a></li> <li><a> Link 3</a></li> </ul> it looks like the links are duplicated, so in my opinion this is because: module configuration (you added those links twice) tpl modification it's hard to say without an access to the BO / .tpl file, but in my opinion you should try to reinstall module and use it with default settings (and tpl files) Link to comment Share on other sites More sharing options...
zero22hero Posted May 10, 2013 Author Share Posted May 10, 2013 you pasted above something like: <ul> <li><a> Link 1</a></li> <li><a> Link 2</a></li> <li><a> Link 3</a></li> <li><a> Link 1</a></li> <li><a> Link 2</a></li> <li><a> Link 3</a></li> </ul> it looks like the links are duplicated, so in my opinion this is because: module configuration (you added those links twice) tpl modification it's hard to say without an access to the BO / .tpl file, but in my opinion you should try to reinstall module and use it with default settings (and tpl files) I checked and the settings should be fine. Also, I tried to re-install the module but no luck. Link to comment Share on other sites More sharing options...
vekia Posted May 10, 2013 Share Posted May 10, 2013 Yes, but you said that you modified the .tpl file of this module. Where you modified this file? In modules/blocktopmenu/ or in themes/modules/blocktopmenu ? if second method, prestashop uses this file to compile the template. Sorry for my questions, but all of this are necessary for understanding the issue Link to comment Share on other sites More sharing options...
zero22hero Posted May 10, 2013 Author Share Posted May 10, 2013 Yes, but you said that you modified the .tpl file of this module. Where you modified this file? In modules/blocktopmenu/ or in themes/modules/blocktopmenu ? if second method, prestashop uses this file to compile the template. Sorry for my questions, but all of this are necessary for understanding the issue Modifcations are in modules/blocktopmenu/ I think the problem was with the hook when I tried to modify the default theme I've just re-install prestashop and change the header.tpl to test, you can try it, please check my attachment prestashop.zip Link to comment Share on other sites More sharing options...
zero22hero Posted May 10, 2013 Author Share Posted May 10, 2013 Hi vekia, u still there? Link to comment Share on other sites More sharing options...
vekia Posted May 10, 2013 Share Posted May 10, 2013 hello Yes I am, i downloaded it and i will test it ASAP wait for my response hey and what about blocktopmenu? you only attached header.tpl file Link to comment Share on other sites More sharing options...
zero22hero Posted May 11, 2013 Author Share Posted May 11, 2013 hello Yes I am, i downloaded it and i will test it ASAP wait for my response hey and what about blocktopmenu? you only attached header.tpl file Hi vekia, I've updated the information about this issue in #1 post And I think I found what the problem is... It happened with my performance settings in BO Template Cache -> Force Compilation, Cache -> No We can avoid this issue by restoring to default settings after we finish developing project but I just want to figure out what caused the problem? Link to comment Share on other sites More sharing options...
vekia Posted May 11, 2013 Share Posted May 11, 2013 Maybe in cache blocktopmenu was with duplicated output for menu content (i know that you tried to something with that) you should try to remove cache files, then recompile the theme - and turn it on again. If the problem will not occur again - the problem was with what i said 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