Jump to content

Edit History

matik4

matik4


solved

Hello,

I wonder if anyone can help me with this.


I'm trying to edit the shopping cart template in Presta 1.7.5.1 so that the product customization text is displayed with preserved line breaks.

Currently if there are any line breaks Presta ignores them. For example customer's product customization text is:
line 1 blabla
line 2 blablab
line 3 blablaba

Prestashop will display it in the summary as:
line 1 blabla line 2 blablab line 3 blablaba

I have it sorted in the back office by using:
 

{$data['value']|replace:' ':'<br />'}

I cannot get it working in the front office. The above code breaks the website (used with $field.text instead).
I got it working partially by using:

{nl2br($field.text)}

However this results in <br /> tags shown as a text - rather than doing anything - as on the below example:

line 1 blabla<br /> line 2 blablab<br /> line 3 blablaba


The file I am trying to edit is located in cart-detailed-product-line.tpl and is as follows:

 

<div>
  {foreach from=$customization.fields item="field"}
                    <div class="product-customization-line row">
                      <div class="col-sm-6 col-xs-6 perso-koszyk">
                        {$field.label}
                      </div>
                      <div class="col-sm-6 col-xs-6 perso-koszyk">
                        {if $field.type == 'text'}
                          {if (int)$field.id_module}
                            {$field.text nofilter}
                          {else}
                           {nl2br($field.text)}
                          {/if}
                        {elseif $field.type == 'image'}
                          <img src="{$field.image.small.url}">
                        {/if}
                      </div>
                    </div>
                  {/foreach}
                </div>

I would really appreciate any help on this!

Kind Regards,
Mateusz

matik4

matik4

Hello,

I wonder if anyone can help me with this.


I'm trying to edit the shopping cart template in Presta 1.7.5.1 so that the product customization text is displayed with preserved line breaks.

Currently if there are any line breaks Presta ignores them. For example customer's product customization text is:
line 1 blabla
line 2 blablab
line 3 blablaba

Prestashop will display it in the summary as:
line 1 blabla line 2 blablab line 3 blablaba

I have it sorted in the back office by using:
 

{$data['value']|replace:' ':'<br />'}

I cannot get it working in the front office. The above code breaks the website (used with $field.text instead).
I got it working partially by using:

{nl2br($field.text)}

However this results in <br /> tags shown as a text - rather than doing anything - as on the below example:

line 1 blabla<br /> line 2 blablab<br /> line 3 blablaba


The file I am trying to edit is located in cart-detailed-product-line.tpl and is as follows:

 

<div>
  {foreach from=$customization.fields item="field"}
                    <div class="product-customization-line row">
                      <div class="col-sm-6 col-xs-6 perso-koszyk">
                        {$field.label}
                      </div>
                      <div class="col-sm-6 col-xs-6 perso-koszyk">
                        {if $field.type == 'text'}
                          {if (int)$field.id_module}
                            {$field.text nofilter}
                          {else}
                           {nl2br($field.text)}
                          {/if}
                        {elseif $field.type == 'image'}
                          <img src="{$field.image.small.url}">
                        {/if}
                      </div>
                    </div>
                  {/foreach}
                </div>

I would really appreciate any help on this!

Kind Regards,
Mateusz

×
×
  • Create New...