Knowledgebase

How to add a "Contact Us" link to a CMS block in PrestaShop

In PrestaShop the CMS Block module displays by default an Information block in the left column of the store's frontend, as well as some footer links. The Information box shows links to different CMS pages. From the backend of your PrestaShop you can create as many CMS pages as you want (Tools tab>CMS sub-tab), and from the settings of the CMS Block module you can add links to these pages in any of the blocks displayed by the module (e.g. left, right, footer).

The Contact Us page, however, is not a CMS page, so you can't use the module's options to add it as a link in the default Information block, for example. To do this you have to modify the code of the file blockcms.tpl. If your PrestaShop is installed in a folder called prestashop in the root public_html directory of your PrestaShop hosting account, then the path to the file would be public_html/prestashop/modules/blockcms/blockcms.tpl. One way to modify the file is from the Files section of the Pixie control panel.

Inside the blockcms.tpl file you'll see a section labeled <!-- Block CMS module -->. In that section you'll see the following tags:

<ul class="block_content">

</ul>

Between them there's some code for the different links. Somewhere on a new line after the opening tag (<ul class="block_content">) or before the closing tag (</ul>) insert the following code:

<li><a href="{$link->getPageLink('contact-form.php')}" 
title="{l s='Contact Us' mod='blockcms'}">{l s='Contact Us' mod='blockcms'}</a></li>

If you put the code right after the above mentioned opening tag, the Contact Us link will be the first in the CMS block. If you put it right before the closing tag, it will be the last link.

To be able to see the result of changes to template files on the frontend of the store, you also have to enable the Force Compile option. You can do this from the Performance sub-tab of the backend's Preferences tab. After you're done with the changes and you've checked the results on the frontend, disable the option.

You should also keep in mind that changes to core files are overwritten during an update of the application.

Was this answer helpful?

 Print this Article

Also Read