• Resolved Xavier

    (@xav89)


    Hi!

    Thanks for this great plugin! Following the last update, I am running into a new issue with filters:
    – if I am setting a grid without specific query and adding filters, filters work great and I can view filtered products

    – If I am setting a grid with a query on a specific category (as I did with previous version), now the filters are not working, even if the filtered category and sub-category from the queried category.

    You can try by yourself on my testing webpage: https://dev.haras-olympe.fr/522-2/
    I set up both grids, one with query and the second one without.

    Thanks in advance for your help!
    Regards,
    Xavier

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WPXPO

    (@wpxpo)

    Hello,
    Please Check the Screenshot.

    View post on imgur.com

    Your site has “UberMenu” and it causes a JS error. That’s why our filter plugins can not work perfectly. Just uninstall “UberMenu” and then check. Hope it will work perfectly.

    Thread Starter Xavier

    (@xav89)

    Hello,

    Thanks for your reply. I tried deactivating Ubermenu, which removed the JS error, but did not solve the issue with filters.
    I also updated Ubermenu which also removed the JS error, but the filters are not working as well.
    I do not think this is an issue with other plugins as in one case filters are working, and in the other case the filters are not working (See demo for both cases on the linked page https://dev.haras-olympe.fr/522-2/ ). Filters were working fine before updating to the last version of the plugin

    Thanks in advance for your help,
    Xavier

    Thread Starter Xavier

    (@xav89)

    Hello again!

    From what I could debug, the issue is in classes\Blocks.php line 108 when you are merging arrays
    $attr = array_merge($attr, $value['attrs']);

    When a parent category is pre-selected, the ‘product_cat’ in $value[‘attrs’] is already set up to the parent category, so when merging, this value is kept and not replaced by the subcategory from $attr as expected

    I managed to get it working by moving the merging before retrieving the new values of product_cat/product_tag:

    
    if($value['attrs']['blockId'] == $blockId) {
    	$attr = $this->all_blocks[$blockRaw]->get_attributes(true);
    	
    	$attr = array_merge($attr, $value['attrs']);
    	
    	$attr['queryTax'] = $taxtype == 'product_cat' ? 'product_cat' : 'product_tag';
    	if (json_encode(array($taxonomy))!=='[]') {
    		if($taxtype == 'product_cat' && $taxonomy) {
    			$attr['queryCat'] = json_encode(array($taxonomy));
    		}
    		if($taxtype == 'product_tag' && $taxonomy) {
    			$attr['queryTag'] = json_encode(array($taxonomy));
    		}
    	}
    	echo $this->all_blocks[$blockRaw]->content($attr, true);
    	die();
    }

    There might be some better way to solve it, I’m no pro in php ??

    Xavier

    • This reply was modified 4 years, 2 months ago by Xavier. Reason: typo
    Plugin Author WPXPO

    (@wpxpo)

    Please install the latest productx version 2.0.2.

    Plugin Contributor Anik Biswas

    (@anik4e)

    This issue has been solves in previous version of 2.0.2 . And no doubt that @xav89 is a pro programmer ?? .

    I marked your topic as a resolved. If you have any more issue please create a new topic

    Thanks a lot.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Filters not wot working with query on category’ is closed to new replies.