Basic tutorials 13.03.2014 block, contact, footer, modification, module, smarty, template, tpl

How to add line breaks to address

In block contact infos module located in footer section of your store. Read this free quick guide related to modification of module template files

Today I want to show you little trick related to module which displays shop contacts information in your footer. This guide is based on PrestaShop 1.6 but it will work also in 1.5 and older releases of PS engine. So, let me explain what we trying to achieve ;) This tiny module allows to display store informations in footer section, you can fill form (on module configuraiton page) with credentials of your company. As you can see on image below in front office there is no line breaks for address field. In this guide i will show you how easily you can add line breaks to the front office view.

 

Block contact infos module, configuration page and front office view

block contact infos witohut line breaks prestashop

 

 

Modification of module template file

In this case we have to modify module template file named blockcontactinfos.tpl. So, please open this module file (if exists, open file from themes directory themes/default-bootstrap/modules/blockcontactinfos/blockcontactinfos.tpl) and instead of original (default) code:

<i class="icon-map-marker"></i>{$blockcontactinfos_company|escape:'html':'UTF-8'}{if $blockcontactinfos_address != ''}, {$blockcontactinfos_address|escape:'html':'UTF-8'}{/if}

use this one:

<i class="icon-map-marker"></i>{$blockcontactinfos_company|escape:'html':'UTF-8'}{if $blockcontactinfos_address != ''}, <br />{$blockcontactinfos_address|nl2br}{/if}

 

And that's all, your block contact informations will add line breaks exactly as you've got defined in back office:

block contact infos with line breaks prestashop addon

 

Zdjęcie autora: Milosz Myszczuk

Artykuł napisany przez Milosza Myszczuka, eksperta PrestaShop i oficjalnego moderatora społeczności PrestaShop. CEO i założyciel agencji interaktywnej VEKIA. Dowiedz się więcej.

If you like this article, support our work!

Comments