Display product option's image in the tooltip

  • Posts: 22
  • Thank you received: 1
7 years 6 months ago #253774

-- HikaShop version -- : 2.6.4
-- Joomla version -- : 3.6.4
-- PHP version -- : 5.6.27
-- Browser(s) name and version -- : Firefox 49.0.2

Hello,
found several discussions about that, but no one leading to a concrete solution for the problem/request.

Product options are additional products added to the main products.
Since the options are real products in HikaShop, they have also their product images.
Actually is not possible to show the image next to the optional product in the "options" list.

But, for each optional product we have the "description" displayed in a tooltip.
If i add an image in the description field, the image is not displayed.

Tried to look at the code and I found why, working through overrides.

file: option.php line 126

$description = $this->escape(strip_tags(JHTML::_('content.prepare',$optionInfo->product_description)));

Actually, due to the "strips_tags" PHP function, all the HTML tages are stripped and plain text is shown in the tooltip.

If I try to use "allowable_tags" function coupled with strip_tags, in order to allow the image tags, it doesn't work.

If i remove "strips_tags" I see all the HTML code (product name + link to the image). Please remember that the image is included into the Product description (for each additional product). Output in the image attached.

What i'm not able to do is to display the "result" of the HTML code.
If the code will be treated as HTML, the image will be displayed in the tooltip.

Can you please help with this?
Thanks!

Attachments:
Last edit: 7 years 6 months ago by Lippo.

Please Log in or Create an account to join the conversation.

  • Posts: 81597
  • Thank you received: 13080
  • MODERATOR
7 years 6 months ago #253798

Hi,

Try it like that:
$description = JHTML::_('content.prepare',$optionInfo->product_description);

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 1
7 years 6 months ago #253863

Hi Nicolas,
thank you for your answer.

Unfortunately it doesn't work.
It breaks the HTML tags and it still shows "unexpanded" html tags.

See the image attached.

Can you please provide other suggestions?

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81597
  • Thank you received: 13080
  • MODERATOR
7 years 6 months ago #253895

Hi,

Then it means that the tooltips system doesn't support HTML tags.
You need to replace the line:
$options='<span class="hikashop_option_info" title="'.$description.'">'.$options.'</span>';
with a tooltip tag. For example: extensions.joomla.org/extension/tooltips

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 1
7 years 6 months ago #253905

Hi Nicolas,

in this case I should include the content of the option in the tip tag.
Can you suggest the syntax for this?

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 1
7 years 6 months ago #253917

BTW fixed in a different way.
Decided to remove the tooltip and to display the product description (including the image) instead of the product title in the option box.

Changed this line:

$html = '<span class="hikashop_option_name">'.$optionInfo->product_name.$options.'</span></td><td>' . $html;

with:
$html = '<span class="hikashop_option_name">'.$optionInfo->product_description.$options.'</span></td><td>' . $html;

Result attached

Attachments:
The following user(s) said Thank You: Jerome

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum