Jump to content
thirty bees forum
  • 0

Is there an easy way to add CMS page links to the navigation bar?


Angstony_2

Question

In particular I'd like to add an "About us" link to the navigation bar in the community default theme. I thought this would be a common requirement, so I'm quite surprised no-one has apparently asked here before, unless I'm searching on the wrong terms.

I've tried to work out how to do this for myself, but it doesn't seem like it's possible from the back office as far as I can tell. Or am I missing something obvious again?

If not, any guidance would be greatly appreciated.

Link to comment
Share on other sites

10 answers to this question

Recommended Posts

  • 0

I figured it out and also added a 'Home' link with the help of this old Prestashop post. The code's not exactly the same, but it was pretty straightforward to adapt – even for a non developer, like me! :)

For anyone else searching for this here, I added this code to the top of the '…/modules/blockcontact/nav.tpl' file:

```

  • {l s='Home' mod='blockcontact'}
  • {l s='About' mod='blockcontact'}
  • ``` Any experts reading this please say if I've done anything wrong or if there is a better way to accomplish this.

    Link to comment
    Share on other sites

    • 0

    Community theme has such a link in the footer by default.

    Assuming you mean the top menu with "navigation bar", one can add (and remove) links there on the configuration page of module Block Top Menu. Links to categories as well as links to shop CMS pages and even arbitrary links.

    Link to comment
    Share on other sites

    • 0

    Well I've just tried it and it does kinda work with a hook transplant to displayNav, but it's just added another row underneath the existing links. So I'd have to figure out how to remove the top row and then apply the inverse styling.

    To be honest that's already seeming like far more effort than what I've already done! But I do appreciate your suggestions. :)

    Link to comment
    Share on other sites

    • 0

    @angstony_2 said:

    <li id="blockcontact-about" class="blockcontact"> <a href="{$link->getCmsLink('4')|escape:'html':'UTF-8'}" title="{l s='About us' mod='blockcontact'}"> {l s='About' mod='blockcontact'} </a> </li>

    I encountered a small problem with this code yesterday. I created a new CMS page on my testing site and put a link to it in the nav bar. Once I was happy everything was working right I copied it all across to the live site. However, I'd forgotten that I'd previously added a temporary CMS page on the live site, so when I added the new CMS page there it had a different ID to the one on the testing site. This is inconvenient because it means either maintaining two different nav.tpl files, pointing to different IDs, or re-copying the live site to the testing site. So I looked in the link.php file to see if a name could be used instead of an ID, and sure enough it turns out you can use the alias (AKA 'friendly url') provided the ID parameter is passed as an empty string, so the ID becomes irrelevant.

    So this is the code I'm using now:

    <li id="blockcontact-about" class="blockcontact"> <a href="{$link->getCmsLink('', 'about-us')|escape:'html':'UTF-8'}" title="{l s='About us' mod='blockcontact'}"> {l s='About' mod='blockcontact'} </a> </li> I think this is a much better way of getting the desired CMS page link, so I thought I'd share it here.

    Link to comment
    Share on other sites

    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...