Post by r94ever » Sun Oct 02, 2011 1:59 pm

Hi all,

I hava a question about editing Opencart source code that how to enable HTML code in Product Attribute when add or edit any product? I'm using Opencart 1.5.1.3

Thanks and sorry for my English! :)

Newbie

Posts

Joined
Sun Oct 02, 2011 1:45 pm

Post by salehjoon » Fri Nov 25, 2011 4:48 am

Did you figure out how to do this? I need to do the exact same thing.

New member

Posts

Joined
Sun Nov 20, 2011 12:17 pm

Post by salehjoon » Tue Nov 29, 2011 1:12 pm

A solution for this was suggested by Simon. I'm just re-posting it:

edit: admin/model/catalog/product.php

find 2 X occurrences of

Code: Select all

foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
add after both occurrences

Code: Select all

$product_attribute_description['text'] = html_entity_decode($product_attribute_description['text'], ENT_QUOTES, 'UTF-8');

New member

Posts

Joined
Sun Nov 20, 2011 12:17 pm

Post by rwalker » Thu Mar 15, 2012 8:08 am

Did not work in 1.5.1.2

Discount Golf Clubs and Golf Equipment - Powered by Opencart


New member

Posts

Joined
Fri Jul 01, 2011 8:14 am

Post by MissLiss » Thu Mar 15, 2012 12:23 pm

I'd also like this feature as well as be able to add an image of the attribute.

New member

Posts

Joined
Thu Mar 08, 2012 5:33 pm

Post by qahar » Thu Mar 15, 2012 1:47 pm

What you need to do is not put the html_entity_decode() on admin, but on the front template.
Assuming you have an product attribute called "link", on front template (.tpl):

Code: Select all

    <?php echo html_entity_decode($attribute['link']); ?>
For the complete tuts, you can read here Product Attribute as Additional Info

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by mattalt » Thu Jun 21, 2012 10:50 am

MissLiss wrote:I'd also like this feature as well as be able to add an image of the attribute.
Hi! Were you able to solve this? I´d also like to add an image.

New member

Posts

Joined
Thu May 31, 2012 7:12 am

Post by qahar » Thu Jun 21, 2012 5:11 pm

With my code above you can put the image manually:

Code: Select all

<img src="image/data/your-image.jpg" alt="alternatif text" />

User avatar
Expert Member

Posts

Joined
Tue Jun 29, 2010 10:24 pm
Location - Indonesia

Post by Horhecart » Thu Jan 10, 2013 7:15 am

This works great! TY qahar

Newbie

Posts

Joined
Sat Dec 29, 2012 5:03 am

Post by labeshops » Sat May 03, 2014 12:18 am

This no longer works in 1.5.6.x - any idea how to fix???

I tried http://www.opencart.com/index.php?route ... earch=html which works if I resave every single product, but that is obviously not practical with over 6000 products!

Running Opencart v3.0.3.2 with multi-stores from https://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by labeshops » Tue May 06, 2014 11:28 pm

qahar wrote:What you need to do is not put the html_entity_decode() on admin, but on the front template.
Assuming you have an product attribute called "link", on front template (.tpl):

Code: Select all

    <?php echo html_entity_decode($attribute['link']); ?>
For the complete tuts, you can read here Product Attribute as Additional Info
Okay, this worked for me. I edited product.tpl changing:

Code: Select all

<td><?php echo $attribute['text']; ?></td>
to

Code: Select all

<td><?php echo html_entity_decode($attribute['text']); ?></td>
Thanks qahar!

Running Opencart v3.0.3.2 with multi-stores from https://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by sidalex » Wed Jul 16, 2014 2:15 am

^^
but when i do compare my products , it shows plain html on the compare page :
Image

any help ?

Newbie

Posts

Joined
Sat Jul 12, 2014 10:29 pm

Post by labeshops » Wed Jul 16, 2014 6:44 am

edit catalog/controller/product/compare.php

find:

Code: Select all

foreach ($attribute_groups as $attribute_group) {
		foreach ($attribute_group['attribute'] as $attribute) {
			$attribute_data[$attribute['attribute_id']] = $attribute['text'];
		}
	}
change to:

Code: Select all

foreach ($attribute_groups as $attribute_group) {
		foreach ($attribute_group['attribute'] as $attribute) {
			$attribute_data[$attribute['attribute_id']] = html_entity_decode($attribute['text']);
		}
	}

Running Opencart v3.0.3.2 with multi-stores from https://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by sidalex » Wed Jul 16, 2014 10:48 am

thanks dude :) it worked :-*

Newbie

Posts

Joined
Sat Jul 12, 2014 10:29 pm

Post by labeshops » Wed Jul 16, 2014 7:37 pm

Lol not a dude, but no problem. Glad it helped :)

Running Opencart v3.0.3.2 with multi-stores from https://www.labeshops.com which has links to all my stores.

Image


User avatar
Expert Member

Posts

Joined
Thu Aug 04, 2011 4:41 am
Location - Florida, USA

Post by shohag0910 » Wed Oct 03, 2018 8:36 pm

my opencart version 3.0.2.0 how to implement please give instruction

Newbie

Posts

Joined
Sun Sep 04, 2016 4:06 pm
Who is online

Users browsing this forum: No registered users and 75 guests