Is there a way to put a clickable link in product attributes? I tried to put a link to an image in the attribute but the result is a text displaying the html code.
Last edited by salehjoon on Tue Nov 29, 2011 1:09 pm, edited 1 time in total.
v 1.5.1
i want to enable html formatting for different product attributes
what do i have to modify & where ?
i want to enable html formatting for different product attributes
what do i have to modify & where ?
Here Are Your Options :
1st Option: Web3DesignStudio
More Options ? - What More Do You Need ? !
edit: admin/model/catalog/product.php
find 2 X occurrences of
add after both occurrences
find 2 X occurrences of
Code: Select all
foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
Code: Select all
$product_attribute_description['text'] = html_entity_decode($product_attribute_description['text'], ENT_QUOTES, 'UTF-8');
I did what you said but it didn't work.
first occurrence
second occurrence:
first occurrence
Code: Select all
if (isset($data['product_attribute'])) {
foreach ($data['product_attribute'] as $product_attribute) {
if ($product_attribute['attribute_id']) {
$this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");
foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
//added the following line to enable html in product attribute description
$product_attribute_description['text'] = html_entity_decode($product_attribute_description['text'], ENT_QUOTES, 'UTF-8');
//end of the code for adding html text.
$this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int)$product_id . "', attribute_id = '" . (int)$product_attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', text = '" . $this->db->escape($product_attribute_description['text']) . "'");
}
}
}
}
Code: Select all
if (!empty($data['product_attribute'])) {
foreach ($data['product_attribute'] as $product_attribute) {
if ($product_attribute['attribute_id']) {
$this->db->query("DELETE FROM " . DB_PREFIX . "product_attribute WHERE product_id = '" . (int)$product_id . "' AND attribute_id = '" . (int)$product_attribute['attribute_id'] . "'");
foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
//added the following line to enable html in product attribute description
$product_attribute_description['text'] = html_entity_decode($product_attribute_description['text'], ENT_QUOTES, 'UTF-8');
//end of the code for adding html text.
$this->db->query("INSERT INTO " . DB_PREFIX . "product_attribute SET product_id = '" . (int)$product_id . "', attribute_id = '" . (int)$product_attribute['attribute_id'] . "', language_id = '" . (int)$language_id . "', text = '" . $this->db->escape($product_attribute_description['text']) . "'");
}
}
}
}
Oh thats cool to add a unique link for each product ....uksitebuilder wrote:edit: admin/model/catalog/product.php
find 2 X occurrences ofadd after both occurrencesCode: Select all
foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
Code: Select all
$product_attribute_description['text'] = html_entity_decode($product_attribute_description['text'], ENT_QUOTES, 'UTF-8');
it should work salejoon
I tested it before posting (something I very rarely do lol)
Your code looks correct too, so not sure what else to suggest.
Maybe you have vqmod installed with useCache set to True.
If so, clear your vqmod/vqcache folder
I tested it before posting (something I very rarely do lol)
Your code looks correct too, so not sure what else to suggest.
Maybe you have vqmod installed with useCache set to True.
If so, clear your vqmod/vqcache folder
I think 1.5.2 broke this mod. I had it working, updated to 1.5.2, then re-did mod to the file and does not function.
uksitebuilder wrote:edit: admin/model/catalog/product.php
find 2 X occurrences ofadd after both occurrencesCode: Select all
foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
Code: Select all
$product_attribute_description['text'] = html_entity_decode($product_attribute_description['text'], ENT_QUOTES, 'UTF-8');
would be wicked if this was some sort of Vqmod or even in the next iteration of the core. :-))
Thanks for this works well on 1.5.1!uksitebuilder wrote:edit: admin/model/catalog/product.php
find 2 X occurrences ofadd after both occurrencesCode: Select all
foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
Code: Select all
$product_attribute_description['text'] = html_entity_decode($product_attribute_description['text'], ENT_QUOTES, 'UTF-8');
I'm attempting to show the attribute next to the price following this thread: http://forum.opencart.com/viewtopic.php?f=139&t=50476 this is what I've got:
Code: Select all
<!-- Start Additional Info -->
<?php if ($attribute_groups) { ?>
<?php foreach ($attribute_groups as $attribute_group) { ?>
<?php if ($attribute_group['name'] == 'Product Info') { ?>
<?php foreach ($attribute_group['attribute'] as $attribute) { ?>
<span><?php echo $attribute['name']; ?></span> <?php echo html_entity_decode($attribute['text'], ENT_QUOTES, 'UTF-8'); ?><br />
<?php } ?>
<?php } ?>
<?php } ?>
<?php } ?>
<!-- End Additional Info -->
Thanks,
Rian
Discount Golf Clubs and Golf Equipment - Powered by Opencart
for reference on 2.1.0.1 for options descriptions to make links the code in 2 places on options.php is this:
edit***
i've also added it in a 3rd place under the edit function...
however, when going to edit the option, i cannot edit the html code - so i have to delete the entire option (and remove from product first) and re-add a new one with code.... a bit tedious, unless someone else has an idea?
thanks in advance
Code: Select all
$option_value_description['name'] = html_entity_decode($option_value_description['name'], ENT_QUOTES, 'UTF-8');
i've also added it in a 3rd place under the edit function...
however, when going to edit the option, i cannot edit the html code - so i have to delete the entire option (and remove from product first) and re-add a new one with code.... a bit tedious, unless someone else has an idea?
thanks in advance
thank you.uksitebuilder wrote: ↑Tue Nov 29, 2011 12:14 amedit: admin/model/catalog/product.php
find 2 X occurrences ofadd after both occurrencesCode: Select all
foreach ($product_attribute['product_attribute_description'] as $language_id => $product_attribute_description) {
Code: Select all
$product_attribute_description['text'] = html_entity_decode($product_attribute_description['text'], ENT_QUOTES, 'UTF-8');
it works beatifully on OC 3.0.2.0
Who is online
Users browsing this forum: Majestic-12 [Bot] and 17 guests