Post by ianhaney50 » Wed Jun 25, 2025 3:02 am

I've got a option name called Front Screen (Glass Only) for the radio type options and I would like to add a line break or br html tag to the name so it would look like the following on the product page
Front Screen
(Glass Only)
£price

Is that possible to do in opencart 3.0.4.0?
Last edited by ianhaney50 on Wed Jun 25, 2025 10:28 pm, edited 1 time in total.

Active Member

Posts

Joined
Fri Apr 29, 2016 4:21 am

Post by khnaz35 » Wed Jun 25, 2025 3:07 am

Front Screen<br>(Glass Only)

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by ianhaney50 » Wed Jun 25, 2025 3:10 am

khnaz35 wrote:
Wed Jun 25, 2025 3:07 am
Front Screen<br>(Glass Only)
I tried that but on the product page on the front end, it shows <br> within the text instead of putting it on a new line

Active Member

Posts

Joined
Fri Apr 29, 2016 4:21 am

Post by khnaz35 » Wed Jun 25, 2025 3:44 am

Try
{{ option_value.name|raw }}

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia

Post by ianhaney50 » Wed Jun 25, 2025 5:01 am

khnaz35 wrote:
Wed Jun 25, 2025 3:44 am
Try
{{ option_value.name|raw }}
Thank you, I tried that but still got Front Screen<br>(Glass Only)

Active Member

Posts

Joined
Fri Apr 29, 2016 4:21 am

Post by paulfeakins » Wed Jun 25, 2025 6:02 pm

ianhaney50 wrote:
Wed Jun 25, 2025 5:01 am
Thank you, I tried that but still got Front Screen<br>(Glass Only)
You won't be able to get the < and > past the PHP htmlentities() type functions. You'll need to modify the code.

UK OpenCart Hosting | OpenCart Audits | OpenCart Support - please email info@antropy.co.uk


User avatar
Legendary Member
Online

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - London Gatwick, United Kingdom

Post by ianhaney50 » Wed Jun 25, 2025 7:09 pm

paulfeakins wrote:
Wed Jun 25, 2025 6:02 pm
ianhaney50 wrote:
Wed Jun 25, 2025 5:01 am
Thank you, I tried that but still got Front Screen<br>(Glass Only)
You won't be able to get the < and > past the PHP htmlentities() type functions. You'll need to modify the code.
What file would I need to modify and what code would I need to look for please?

Active Member

Posts

Joined
Fri Apr 29, 2016 4:21 am

Post by ADD Creative » Wed Jun 25, 2025 7:25 pm

You could try something like the following.

Code: Select all

{{ option_value.name|replace({'(': '<br>('}) }}

www.add-creative.co.uk


Guru Member

Posts

Joined
Sat Jan 14, 2012 1:02 am
Location - United Kingdom

Post by ianhaney50 » Wed Jun 25, 2025 10:27 pm

ADD Creative wrote:
Wed Jun 25, 2025 7:25 pm
You could try something like the following.

Code: Select all

{{ option_value.name|replace({'(': '<br>('}) }}
Thank you, I worked it out a different way that looks to have worked, I changed the database to the following as it was putting <br> in the database as &amp;lt;br&amp;gt; so updated it using the following sql in phpmyadmin

Code: Select all

UPDATE oc_option_value_description
SET name = REPLACE(name, '&amp;lt;br&amp;gt;', '<br>')
WHERE name LIKE '%&amp;lt;br&amp;gt;%';
I then used the code

Code: Select all

{{ option_value.name|raw }}
It looks to have worked

Active Member

Posts

Joined
Fri Apr 29, 2016 4:21 am

Post by khnaz35 » Thu Jun 26, 2025 1:17 am

Great!

Got an urgent question that’s keeping you up at night? There might just be a magical inbox ready to help: khnaz35@gmail.com
Enjoy nature ;) :) :-*


User avatar
Active Member

Posts

Joined
Mon Aug 27, 2018 11:30 pm
Location - Malaysia
Who is online

Users browsing this forum: No registered users and 71 guests