Problem with filter on manufacturers

  • Posts: 49
  • Thank you received: 4
10 years 2 months ago #204608

-- HikaShop version -- : Business: 2.4.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.41
-- Browser(s) name and version -- : chrome, IE 11
-- Error-message(debug-mod must be tuned on) -- : No error message

Hello,

I created a system of filters with hikashop business on different types of data (categories, custom fields, manufacturer). When I enable all the filters but the one on the manufacturers everything is fine, but as soon as I activate the filter on the manufacturers all the other filter are not functioning anymore.

You can access the frontend using the test account: demo test

Attached are two screenshots of the backend for two filters, the one on manufacturers and another on a custom field.

Thanks in advanced,

Romain

Attachments:

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

  • Posts: 84247
  • Thank you received: 13690
  • MODERATOR
10 years 2 months ago #204613

Hi,

I would first recommend to download the latest version of HikaShop and install it in order to get the different fixes that we added on filters since the release of the 2.4.
If that doesn't help, try to turn on the "redirect post mode" setting of the HikaShop configuration.
That will also allow us to see the values passed to the system in the URL when using the filters in case that also doesn't help.

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

  • Posts: 49
  • Thank you received: 4
10 years 2 months ago #204796

Hello,

I updated hikashop and turned on the redirect post mode... Nothing has changed and the values passed seem to be ok.

If you want to compare with another page where filters are ok, then click on the top menu "8+ years".

Thanks in advance,

Romain

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

  • Posts: 49
  • Thank you received: 4
10 years 2 months ago #205436

I still have the problem with the manufacturer filter...

I'm trying to modify the filter query to see if I can correct the bug using onBeforeProductListingLoad(), but the function is not triggered. Do I need to call it in the view?

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

  • Posts: 12953
  • Thank you received: 1778
10 years 2 months ago #206339

Hello Romain,
Sorry for the late reply, I just tested it through your ADVANCED SEARCH module using the "Editor" filter, and it worked fine, but when I went through your "8+ years" menu there wasn't any "Editor" filter so I couldn't test it.
Do you still have your issue ?

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

  • Posts: 49
  • Thank you received: 4
10 years 1 month ago #208305

Hello Mohamed,

The issue has not been solved... so I will re-explain the bug:
- When there is no "Editor" filter, the filters work correctly (as for example on the "8+ years" page where everything is ok)
- When there is an "Editor" filter, only this filter works correctly: for example in the "advanced search" module all the other filters return 0 elements although they all should return elements. If I remove the "Editor" filter from this module, then everything is fine.

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

  • Posts: 84247
  • Thank you received: 13690
  • MODERATOR
10 years 1 month ago #208380

Hi,

Could you provide a backend access to your website along with a link to this thread via our contact form so that we could check your settings ?
www.hikashop.com/support/contact-us.html

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

  • Posts: 26266
  • Thank you received: 4044
  • MODERATOR
10 years 1 month ago #209761

Hi,

We made a patch for the filters and the manufacturer and regarding your issue description, I think that you got the same problem.
You can find the patch on that thread : www.hikashop.com/forum/5-support-en-fran...e-encore.html#209098

In the file "administrator/components/com_hikashop/classes/filters.php" you have to replace

$on.=' INNER JOIN  '.hikashop_table('category').' AS '.$filter->filter_namekey.$i.' ON '.$filter->filter_namekey.$i.'.category_id=b.product_manufacturer_id AND b.product_manufacturer_id IN ('.$manufacturerList.') ';
By
if($manufacturerList != '0')
	$on.=' INNER JOIN  '.hikashop_table('category').' AS '.$filter->filter_namekey.$i.' ON '.$filter->filter_namekey.$i.'.category_id=b.product_manufacturer_id AND b.product_manufacturer_id IN ('.$manufacturerList.') ';

The fix will be include in the next HikaShop release (2.5.1 logically).

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: 49
  • Thank you received: 4
10 years 1 month ago #209867

Thank you very much for this patch. The problem with the manufacturer's filter has been solved.

Nevertheless, I found another problem: with my check-box filter "Age", it is not possible to select multiple values. If I try to do so it resets the filter.

Regards,

Romain

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

  • Posts: 26266
  • Thank you received: 4044
  • MODERATOR
10 years 1 month ago #209880

Hi,

I see that Nicolas already submit a patch in HikaShop but that patch is not yet in the stable package (so it will be in the next release).
Your issue is linked with multi-categories and the "redirect post" feature.

When you select multiple categories (or characteristics, custom fields, ...), you can see in the url : " filter_Par_age=26::29 "
But for the format handling, the code is not parsing correctly that syntax and that's what the Nicolas' patch fixed.

So to fix that for the categories, in the filter class, you can replace :

if($filter->filter_data=='category'){
	if(!($infoGet[0] == $filter->filter_namekey && count($infoGet) == 1)){
		$categoriesList='';
		foreach($infoGet as $cat){
			if($cat != $filter->filter_namekey && is_numeric($cat)){
				$categoriesList.=(int)$cat.',';
			}
		}
By
if($filter->filter_data=='category'){
	if(!($infoGet[0] == $filter->filter_namekey && count($infoGet) == 1)){
		$categoriesList='';
		foreach($infoGet as $cat){
			if($cat == $filter->filter_namekey)
				continue;

			if(is_numeric($cat)){
				$categoriesList.=(int)$cat.',';
			}elseif(is_string($cat)){
				$cat = explode('::',$cat);
				foreach($cat as $selectedCategory){
					$categoriesList.=(int)$selectedCategory.',';
				}
			}
		}
And it will fix the issue for the categories.

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: 49
  • Thank you received: 4
10 years 1 month ago #209974

Hello Jerome,

The patch has a problem: it sometimes adds a value "0" in addition to the selected category. To correct that problem you should replace the line:

if($cat == $filter->filter_namekey)
by:
if(($cat == $filter->filter_namekey) || ($cat == 0))

The filter now works but there is still a problem with the display: when a second value is checked then the corresponding checkboxes are not checked anymore. To correct that, you should replace the following line (1602?):
if(!empty($selected) && is_array($selected) && in_array($cat->category_id, $selected)){
by:
if(!empty($selected) && is_array($selected) && (in_array($cat->category_id, $selected) || strpos($selected[0], $cat->category_id)!==False)){

This patch works if you have only one checkbox filter (in the selected[0]). If you want to adapt it to multiple checkbox filters, you should add a loop and test for each checkbox filter.

Thanks,

Romain

Last edit: 9 years 11 months ago by sauvain.
The following user(s) said Thank You: Jerome

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

  • Posts: 49
  • Thank you received: 4
9 years 11 months ago #214528

The modification above works for filter checkboxes on categories.

Here is the line to be modified for filter checkboxes on custom fields. Replace the line (1683?):

if(!empty($selected) && is_array($selected) && in_array($val[0], $selected)){

by:
if(!empty($selected) && is_array($selected) && (in_array($val[0], $selected) || strpos($selected[0], $val[0])!==False)){

Again for multiple checkboxes on filters, a loop will be required.

Last edit: 9 years 11 months ago by sauvain.

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

  • Posts: 26266
  • Thank you received: 4044
  • MODERATOR
9 years 11 months ago #214531

Hi,

Do you have a sample configuration to test your patch ?

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: 49
  • Thank you received: 4
9 years 11 months ago #214550

Here are the settings I use.

Attachments:
The following user(s) said Thank You: Jerome

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

  • Posts: 26266
  • Thank you received: 4044
  • MODERATOR
9 years 11 months ago #214641

Hi,

Thanks !
The patch will be include in the next release.

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.

Time to create page: 0.091 seconds
Powered by Kunena Forum