Issue with Joomla Search display when searching by Product Code with slashes

  • Posts: 163
  • Thank you received: 14
  • Hikashop Business
6 months 2 weeks ago #279721

-- HikaShop version -- : 3.2.0
-- Joomla version -- : 3.8.0
-- PHP version -- : 5.6.31
-- Browser(s) name and version -- : any
-- Error-message(debug-mod must be tuned on) -- : None

Search has been working fine but some where between the Joomla 3.8.0 and HikaShop 3.2.0 upgrades, we've found that if you now search for a product code that contains a slash (/).

e.g. SHIM/SET it long longer provides a link and the product name in the Joomla search results.

If you replace the slash (/) in the product doe with a dash (-) or just remove it, it works fine.

e.g. the product code SHIM-SET or GreenBook works just fine.

It was working before on the site in question for almost a year (originally built under 2.6.x) and we can replicate it under Joomla 3.8.0 and HikaShop 3.1.1 install as well. No one noticed until today as it is mostly the site owner that searches by product code or tells customs to search by code (when referencing a product).

Thus we don't think it is specific to HikaShop 3.2.0 but instead think it might be related to a Joomla 3.8.0 change that needs to be addressed.

I don't think it is simply filtering because a result does show (including it being tagged "product" and a description) but there is no actual link to the product itself.

Unfortunately I don't have any older Joomla sites to test on (nor do I want to because of security).

I'd test it on your demo site but looks like something is not setup correctly on your Search Module in the side bar (just generates a 404 error).

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

  • Posts: 61826
  • Thank you received: 8793
  • MODERATOR
6 months 2 weeks ago #279757

Hi,

Thanks for your feedback on our demo website. That's a bug we already fixed. I've updated the demo website to get the patch.

But that won't help you. On our demo website, it's the HikaShop filter module that is used, and not the Joomla search module.
From what I can see that looks like a bug of Joomla's search system.
The $needle variable should have its slashes backslashed on the line:
$result->title = preg_replace("/\b($needle)\b/ui", $hl1 . "$1" . $hl2, htmlspecialchars($result->title, ENT_COMPAT, 'UTF-8'));
in the file components/com_search/views/search/view.html.php

Adding the line:
$needle = str_replace('/','\/',$needle);
just before it fixes the issue on my test website.

Last Edit: 6 months 2 weeks ago by nicolas.
The following user(s) said Thank You: jazzmang

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

  • Posts: 61826
  • Thank you received: 8793
  • MODERATOR
6 months 2 weeks ago #279760
The following user(s) said Thank You: jazzmang

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

Time to create page: 0.075 seconds
Powered by Kunena Forum