Tuesday, December 3, 2013

How to manage header links in prestashop

TM headerlinks for Prestashop module is located at the top of the site and displaying links to your site pages.


tmheaderlinks_editing_1


To add or remove an element to TMheaderlinks module you should edit tmheaderlinks.tpl file.


The file is located under /modules/tmheaderlinks folder.


Open the file using any code editor.


The menu is created using unordered list


Each menu element is wrapped with <li> </li&gt tags


The following line of code represents Sitemap menu element



<li><a href="$link->getPageLink('sitemap.php')"if $page_name == 'sitemap'/if>l s='sitemap' mod='tmheaderlinks'</a></li>

 




a href="$link->getPageLink('sitemap.php')" - is the URL to the page

 




l s='sitemap' mod='tmheaderlinks' - is the code for displaying name of the button

 



To add link to Best Sellers page (http://yourdomain.com/best-sales.php) you should add the following line of code to /modules/tmheaderlinks/tmheaderlinks.tpl file



<li><a href="$link->getPageLink('best-sales.php')"if $page_name == 'best-sales'/if>l s='best-sales' mod='tmheaderlinks'</a></li>

 



And clean smarty cache


To change the name of the button you should login to your Prestashop admn panel and naviagate to Tools -> Translations -> select Module Translation from the drop-down menu and click on corresponding flag icon.


tmheaderlinks_editing_2


Search for tmheaderlinks and define a new name for best-sales


tmheaderlinks_editing_3


Scroll down and press Update translations button to save the changes


To add link to some CMS page you should get the link to the page first. Let’s say it is http://yourdomain.com/cms.php?id_cms=4


You should edit /modules/tmheaderlinks/tmheaderlinks.tpl file and add the following line of code



<li><a href="$link->getPageLink('cms.php?id_cms=4')"if $smarty.get.id_cms == '4'/if>l s='about-us' mod='tmheaderlinks'</a></li>

 



Note! The syntax for active highlighting is different for CMS pages.



How to manage header links in prestashop

No comments:

Post a Comment