matik4 Posted May 25, 2019 Share Posted May 25, 2019 (edited) 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 Edited May 27, 2019 by matik4 solved (see edit history) Link to comment Share on other sites More sharing options...
matik4 Posted May 27, 2019 Author Share Posted May 27, 2019 Solved courtesy of @atomek , the solution is as below: {nl2br($field.text) nofilter} Link to comment Share on other sites More sharing options...
octb Posted March 31, 2020 Share Posted March 31, 2020 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now