How to filter on vendor NAME?

  • Posts: 44
  • Thank you received: 2
11 years 4 months ago #114515

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.

Attachments:
Last edit: 11 years 4 months ago by praes.

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

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 4 months ago #114525

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:

		$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:
		$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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 44
  • Thank you received: 2
11 years 4 months ago #114556

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.

  • Posts: 26156
  • Thank you received: 4028
  • MODERATOR
11 years 4 months ago #114569

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.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

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