Jump to content

[solved]Product customization text formatting in shopping cart

Recommended Posts


I wonder if anyone can help me with this.

I'm trying to edit the shopping cart template in Presta 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:


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:


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

I would really appreciate any help on this!

Kind Regards,

Edited by matik4
solved (see edit history)

Share this post

Link to post
Share on other sites

  • 10 months later...

Anyone knows why $field.text is not displaying the text with hyphens/dashes?

I can't seem to figure out why they are removed from the text, in the database the text is shown with hyphens.

Share this post

Link to post
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...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More