Skip to main content

How to filter on vendor NAME?

More
13 years 2 months ago - 13 years 2 months ago #114515 by praes
Hi,

Have a question regarding the filter functions. I'd like to build a filter which allows my customers to filter on the vendors name (instead of the vendors id). As far as I can see it's only possible to add the vendors id to the filter options. That's not so user friendly.

Is there a way to add the vendors name to the option list?

Best regards.
Last edit: 13 years 2 months ago by praes.

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

More
13 years 2 months ago #114525 by Jerome
Hi,

If you want a text search box, it is easily possible.
The idea is to update HikaMarket to modify the filter search when you use a filter on the "product_vendor_id".

You have to edit the file "plugins/hikashop/hikamarket/hikamarket.php" and replace the code:
Code:
$ON_c .= ' LEFT JOIN ' . hikamarket::table('vendor').' AS hikam_vendor ON product_vendor_id = hikam_vendor.vendor_id '; $filters[] = '(hikam_vendor.vendor_published IS NULL OR hikam_vendor.vendor_published = 1)';
By:
Code:
$ON_c .= ' LEFT JOIN ' . hikamarket::table('vendor').' AS hikam_vendor ON product_vendor_id = hikam_vendor.vendor_id '; $filters[] = '(hikam_vendor.vendor_published IS NULL OR hikam_vendor.vendor_published = 1)'; foreach($filters as &$filter) { if(strpos($filter, 'b.product_vendor_id LIKE \'%') !== false) { $filter = str_replace('b.product_vendor_id LIKE', 'hikam_vendor.vendor_name LIKE', $filter); } unset($filter); }
And the filters on the "product_vendor_id" will search on the "vendor_name" with text searchs.
We will see to improve the filter integration with new features in the next release ; But the current patch works good and will be integrated in the next package.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

More
13 years 2 months ago #114556 by praes
Replied by praes on topic How to filter on vendor NAME?
Hi Jerome,

It's a little weird, my setup doesn't have a file path like that. In my installation the path is plugins/hikashop/market/market.php. Are we talking about the same file? I suppose so, because line 401 shows the code that you mention. is that correct?

Kind regards

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

More
13 years 2 months ago #114569 by Jerome
Hi,

Yes sorry, my mistake for the plugin name.
It is the right file and the right line.

That is correct.

Best regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

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

Moderators: Obsidev
Time to create page: 0.158 seconds
Powered by Kunena Forum