Skip to main content

Display product code in search results

7 years 9 months ago #303386 by mad-q
-- url of the page with the problem -- : draganfly.co.uk
-- HikaShop version -- : 4.0.2
-- Joomla version -- : 3.9.0
-- PHP version -- : 7

Hello all,

How would I go about displaying the product code in search results?

Cheers
Iain

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

7 years 9 months ago #303409 by nicolas
Hi,

In the file plugins/search/hikashop_products/hikashop_products.php you can change the line:
$row->title=$row->product_name;
to:
$row->title=$row->product_name.' '.$row->product_code;
Note however that this change will be removed during updates of HikaShop so you would have to reapply it.

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

7 years 8 months ago #303603 by mad-q
Hi Nicolas

Thanks for that however it doesn't display anything. I have tried just $row->title=$row->product_code; and it comes up blank. Could it be something other than product_code...

Cheers
Iain

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

7 years 8 months ago #303606 by nicolas
Hi,

The product_code is not loaded by the MySQL query as it's not needed normally.
You also need to change the line:
$select = ' a.product_id AS id, a.product_name, a.product_alias, a.product_canonical, a.product_created AS created , a.product_description, "'.$new_page.'" AS browsernav';

to:
$select = ' a.product_id AS id, a.product_name, a.product_alias, a.product_canonical, a.product_created AS created , a.product_description, "'.$new_page.'" AS browsernav', a.product_code;
in that same file to get the product_code loaded.

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

7 years 6 months ago #306137 by mad-q
Hi Nicolas

That code change was working great however after the lastest update it now has 404 error. Can you please assist with the latest version.

Cheers

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

7 years 6 months ago #306139 by nicolas
Hi,

I looked at your website, and I see that you have the latest version, but I don't see any 404 error with the search results I found myself. So it must be a problem specific to the products you're using for your tests.
Could you please double check ?
Please provide precise instructions to reproduce the 404 error as I didn't had it on your website when I tried.

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

7 years 4 months ago #307901 by mad-q
Hi

Sorry I missed your reply, I had to remove the code otherwise people wouldn't be able to use the site.

Cheers
Iain

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

Time to create page: 0.085 seconds
Powered by Kunena Forum