HTML within a filter custom field does not work

  • Posts: 69
  • Thank you received: 1
9 years 5 months ago #205944

-- HikaShop version -- : 2.4.0
-- Joomla version -- : 3.3.6
-- PHP version -- : 5.5.25

Hi,

My filters are all working except for filters where I need to enter HTML code... here is my situation:

1. my records have been imported with a custom field called Temperature with values like
600<sup>o</sup>F
800<sup>o</sup>F
etc.

2. this data is preserved in the export... and looks exactly like the above... so far so good

3. when displayed on a web page, the above looks proper... and upon inspection I can see the html code... good so far...

4. the radio button custom field PIE CHART that appears at the bottom of the custom field entry form has values that look valid... that is, the pie chart slices are accurate, and the data to the right of the PIE CHART for the custom field looks like the above... followed by the number of records for each... so it looks like this for example:
600<sup>o</sup>F(6)
800<sup>o</sup>F(9)
etc.
These numbers look accurate.

My issue is that I cannot enter the above values into the custom field VALUES fields.
This custom field is a radio button. When I enter 600<sup>o</sup>F the value changes to 600oF when I save the field... and of course the filter does not work.

How do I enter HTML into the VALUES field of a radio button custom field to allow me to filter on this value?

Thanks,

Dennis


______________
Dennis Kmetz

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

  • Posts: 69
  • Thank you received: 1
9 years 5 months ago #205946

PS.

I tried entering the values with quotes... both single and double quotes. The quotes remain, but the text is change exactly like the above, for example "600<sup>o</sup>F" changes to "600oF" when I save the field.

Dennis


______________
Dennis Kmetz

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

  • Posts: 82867
  • Thank you received: 13373
  • MODERATOR
9 years 5 months ago #205948

Hi,

Yes, that's normal. HTML is not allowed in custom field values.

Change the code:

$field->field_value[] = strip_tags($title) . '::' . strip_tags($value) . '::' . strip_tags($disabled);
to:
jimport('joomla.filter.filterinput');
$safeHtmlFilter = JFilterInput::getInstance(null, null, 1, 1);
$field->field_value[] = $safeHtmlFilter->clean($title,'string'). '::' .  $safeHtmlFilter->clean($value,'string') . '::' .  $safeHtmlFilter->clean($disabled,'string');
in the file administrator/components/com_hikashop/classes/field.php and that should allow HTML in values.

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

Time to create page: 0.056 seconds
Powered by Kunena Forum