- Posts: 16
- Thank you received: 0
Adding HTML code in attribute value?
- stavros
- Topic Author
- Offline
- New Member
-
Less
More
9 years 10 months ago #63188
by stavros
Adding HTML code in attribute value? was created by stavros
Hi I created my groups of attributes and added my values in each of the attribute.
I want to include some HTML code in the value of the attribute such as: instead of showing like this... LED: up to 150W, CFL: up to 150W, halogen: up to 600W, incandescent: up to 600W
to be:
LED: up to 150W<br/>
CFL: up to 150W<br/>
halogen: up to 600W<br/>
incandescent: up to 600W
also might include a click here after the value to link something!!
Can it be done, somehow?
Kind Regards,
Stavros.
I want to include some HTML code in the value of the attribute such as: instead of showing like this... LED: up to 150W, CFL: up to 150W, halogen: up to 600W, incandescent: up to 600W
to be:
LED: up to 150W<br/>
CFL: up to 150W<br/>
halogen: up to 600W<br/>
incandescent: up to 600W
also might include a click here after the value to link something!!
Can it be done, somehow?
Kind Regards,
Stavros.
Please Log in or Create an account to join the conversation.
- Giang Dinh Truong
-
- Offline
- Administrator
-
9 years 10 months ago #63216
by Giang Dinh Truong
Replied by Giang Dinh Truong on topic Adding HTML code in attribute value?
Hello Stavros,
Sorry, you can not add html code to the value of attribute values. It does not allow.
Sincerely, Giang
Sorry, you can not add html code to the value of attribute values. It does not allow.
Sincerely, Giang
Please Log in or Create an account to join the conversation.
- Antonio Grazioli
- Offline
- New Member
-
Less
More
- Posts: 12
- Thank you received: 0
7 years 9 months ago #99640
by Antonio Grazioli
Replied by Antonio Grazioli on topic Adding HTML code in attribute value?
Sorry to resurrect this old post, but I needed to do the same...
actually, it should be possible by modifying products.php in /administrator/components/com_eshop/models
search for the lines
(there should be 2)
and change them to:
this will allow the inputboxes for attributes values NOT to be filtered in any way
actually, it should be possible by modifying products.php in /administrator/components/com_eshop/models
search for the lines
Code:
$attributeValue = JRequest::getVar('attribute_value_' . $langCode);
and change them to:
Code:
$attributeValue = JRequest::getVar('attribute_value_' . $langCode, '', 'post', 'string', JREQUEST_ALLOWRAW );
this will allow the inputboxes for attributes values NOT to be filtered in any way
Please Log in or Create an account to join the conversation.
- Giang Dinh Truong
-
- Offline
- Administrator
-
7 years 9 months ago #99660
by Giang Dinh Truong
Replied by Giang Dinh Truong on topic Adding HTML code in attribute value?
Hello Antonio,
It's fine if you can modify that to make it works as your requirement.
Sincerely, Giang
It's fine if you can modify that to make it works as your requirement.
Sincerely, Giang
Please Log in or Create an account to join the conversation.
- Julian Lilio
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
2 years 3 months ago #155554
by Julian Lilio
Replied by Julian Lilio on topic Adding HTML code in attribute value?
Hi Giang and Team,
I too have to resurrect this old thread as I have an absolute need to do the following:
JoomDonation eShop: HTML code in attribute value field with text longer than 255 characters
The procedure below has been tested on the following environment:
Instead of doing this: {source}<strong>Text</strong>{/source}
Do this: {source}strongText/strong{/source}
Another example that will work too even if what's written on the input field is more than 255 characters (including the tags):
{source}strongulliThis is just a test to see if the the field will accept the total number of characters which was previously set at 255./strong - a href="[/color][url=https://www.synology.com/en-global/products/FS6400#specs][color=#2980b9]https://www.synology.com/en-global/products/FS6400#specs[/color][/url][color=#2980b9]" target="_blank"Complete Specification/a/lilibSecond line/b/li/ul{/source}
Recommendation: Include change in the eShop core (i.e, items 2 and 3 above).
Note: Doing this will have minimal effect on other areas, but will definitely prepare the attribute value to be longer than 255 characters. This is effective for many use cases, even without using HTML tags as enabled by the 3rd party plugin, Sourcerer.
References:
regularlabs.com/sourcerer/download
docs4.regularlabs.com/sourcerer/going-further/advanced
Note: The suggested workaround from joomdonation.com/forum/eshop-general-dis...ute-value.html#99640 of using 'raw' no longer works on Joomla 4.
I hope this helps.
Best regards
Julian
I too have to resurrect this old thread as I have an absolute need to do the following:
- Be able to put HTML tags on the attribute value
- Be able to write a much longer text than 255 characters for the attribute value.
JoomDonation eShop: HTML code in attribute value field with text longer than 255 characters
The procedure below has been tested on the following environment:
- Joomla 4.2.6
- eShop 3.6.2
- PHP 8.0.23
- MySQL 8.0.23
- Install Regular Lab's Sourcerer free edition. Note that Sourcerer has the capability of using double square brackets i.e., [[]] to replace <> which is being stripped (i.e., filtered) by the input field.
- Modify the field "value" from the database table "_eshop_productattributedetails". Change it to type "text" (with no length so it can use a max of 65,535 characters) instead of "varchar" with a length of 255. This can easily be achieved with a tool like phpMyAdmin.
- Remove maxlength="255" the following files so they become similar to the following, respectively:
administrator/components/com_eshop/views/product/tmpl/default_attributes.php - Line 64:
<input class="input-xlarge form-control" type="text" name="attribute_value[]" value="<?php echo htmlentities($productAttribute->value); ?>" />
administrator/components/com_eshop/views\product/tmpl/default_javascript.php - Line 170 (note: in my test, I didn't have to do this):
html += '<input class="input-xlarge form-control" type="text" name="attribute_value[]" value="" />';
Instead of doing this: {source}<strong>Text</strong>{/source}
Do this: {source}strongText/strong{/source}
Another example that will work too even if what's written on the input field is more than 255 characters (including the tags):
{source}strongulliThis is just a test to see if the the field will accept the total number of characters which was previously set at 255./strong - a href="[/color][url=https://www.synology.com/en-global/products/FS6400#specs][color=#2980b9]https://www.synology.com/en-global/products/FS6400#specs[/color][/url][color=#2980b9]" target="_blank"Complete Specification/a/lilibSecond line/b/li/ul{/source}
Recommendation: Include change in the eShop core (i.e, items 2 and 3 above).
Note: Doing this will have minimal effect on other areas, but will definitely prepare the attribute value to be longer than 255 characters. This is effective for many use cases, even without using HTML tags as enabled by the 3rd party plugin, Sourcerer.
References:
regularlabs.com/sourcerer/download
docs4.regularlabs.com/sourcerer/going-further/advanced
Note: The suggested workaround from joomdonation.com/forum/eshop-general-dis...ute-value.html#99640 of using 'raw' no longer works on Joomla 4.
I hope this helps.
Best regards
Julian
Please Log in or Create an account to join the conversation.
- Julian Lilio
- Offline
- New Member
-
Less
More
- Posts: 3
- Thank you received: 0
2 years 3 months ago #155555
by Julian Lilio
Replied by Julian Lilio on topic Adding HTML code in attribute value?
Sorry, I didn't realize earlier that the forum is using Markdown source, hence it stripped some of the square brackets on my example. I hope that those who will reference this will simply get it, i.e., to use double square open and double close brackets instead of the angle brackets.
Please Log in or Create an account to join the conversation.
Moderators: Giang Dinh Truong
Support
Documentation
Information
Copyright © 2025 Joomla Extensions by Joomdonation. All Rights Reserved.
joomdonation.com is not affiliated with or endorsed by the Joomla! Project or Open Source Matters.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.
The Joomla! name and logo is used under a limited license granted by Open Source Matters the trademark holder in the United States and other countries.