Code Showing on Product Options Combo Box

  • Posts: 36
  • Thank you received: 5
2 years 4 months ago #346430

-- HikaShop version -- : 4.6.2
-- Joomla version -- : 3.10.11
-- PHP version -- : 7.4.33

Hello,

Just wanted to report that, under a very specific Hikashop configuration and product setup, HTML code showed up on the combo box for selecting product options (see image attached).
I turned Joomla debug mode on and set Joomla error reporting to maximum and no error was shown reported.

This occurred with a product (P) that had a Characteristic (C) where the first value of C was 0 (the digit zero) and P had P has it's own characteristic. After finding this out I tested placing P as an option in another unrelated product and the same thing (code showing up on combo box for selecting product options) happened.
So I do think this 'display error' happens when a product option is displayed where it's value is 0 (the digit zero). Not surprising given the 'powers' of zero in coding ;).

I don't have a problem with this, just changed the characteristic value to "0.0" and all is OK (thankfully the code didn't take 0.0 as meaning 0!). I also tested with 1 has a characteristic value (to rule out this happened with single digit strings) and no problem in this case.

Though a minor and easy to circumvent 'error' I share this because it might lead the Dev team to find and fix other similar occurrences that could have more serious effects.
I'm sure you'll have a good laugh when you find how this come about in the code :)


VC22
Attachments:
The following user(s) said Thank You: nicolas

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

  • Posts: 83401
  • Thank you received: 13494
  • MODERATOR
2 years 4 months ago #346433

Hi,

Thanks for the report !

Add the code:

if($selectionMethod == 'generic')
				$text = strip_tags($text);
before the line:
$this->row =& $variant;
in the file components/com_hikashop/views/product/tmpl/option.php and it will fix the problem. We'll add the change on our end for the next version of HikaShop too.

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

Time to create page: 0.041 seconds
Powered by Kunena Forum