Skip Navigation

[Resolved] Creating filters for WooCommerce Product View

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 10 replies, has 1 voice.

Last updated by Minesh 1 month ago.

Assisted by: Minesh.

Author
Posts
#2816773

I'm using legacy Views to display specific woocommerce products within the "Physical Items" category. I'm trying to have filters for the child categories of the "Physical Products" category and for price.

hidden link

Price I'd love to create a range price filter like this:
hidden link

Tim

#2816788

oh, I found the price range filter, I didn't even know toolset had this, very cool:
[wpv-control-post-product-price]Price: %%MIN%% — %%MAX%%[/wpv-control-post-product-price]

So I just need to figure out how to choose which woo categories to appear in the filter:
[wpv-control-post-taxonomy taxonomy="product_cat" type="checkboxes" url_param="wpv-product_cat"]

I thought I could do that in the Query Filter but there's no longer an Edit button for that:
hidden link

Tim

#2816834

And something I did seems to have changed the filter behavior, now when I select a filter category all the other category filters disappear other than the categories the current products shown have.

#2816893

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

#2816903

Thanks, this worked, for my referenceI added the code below.

But now the item counter [wpv-found-count] no longer changes when I filter, it remains at 50.

And previously when I would select multiple categories it would do an OR operation, showing me products in both those categories, it no longer works like that. Can I add something to my code below to make it work like this?

add_filter( 'wpv_filter_taxonomy_frontend_search_get_terms_args', 'prefix_modify_get_terms_args', 10, 3 );
function prefix_modify_get_terms_args( $args, $taxonomy, $view_id ) {

if ( $view_id == 82144&& $taxonomy == "product_cat") {
$args['slug'] = array(
'watches',
'sunglasses',
'jewelry',
'handbags',
'signed-memorabilia',
'art-entertainment-memorabilia',
'sports-memorabilia',
'wine-spirits',
);
}

return $args;
}

#2816931

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please share problem URL and admin access details and let me check what's going wrong with your setup.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2817056

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now.

I've adjsuted the "Query Filter" for the taxonomy so it will have "OR" clause with query.

Also, You can add the [wpv-found-count] showtcode within the view's "Loop Editor" section. As you are using the AJAX update you will have to put that within the view's "Loop Editor" section.

<div class="item-count">[wpv-found-count] items  </div> 
#2817064

Thanks. The Or operator now is working, but how can I adjust the "Query Filter" on my live site now? Previously that was editable. How did you adjust it?

And yes I understand I can put [wpv-found-count] with the view's loop, but it had been working within the filter as well until I added that code above to my functions file. I'm guessing that has caused it to not take effect in the Filter area any longer right?

Tim

#2817067

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

To update the query filter on your live site.

*** Please make a FULL BACKUP of your database and website.***
- Edit your view
- Navigate to "Search and Pagination" section and try to "cut" (ctrl+x) the follwoing line temporaryly.

[wpv-control-post-taxonomy taxonomy="product_cat" type="checkboxes" url_param="product_cat"]

- Refresh the edit view page and now with the "Query Filter" section you should be able to edit the query filter for your taxonomy, click on edit button and select the option "Any of the values" and save the query filter.
- Navigate to "Search and Pagination" section and paste the line you cut before at the same place where you added it:

[wpv-control-post-taxonomy taxonomy="product_cat" type="checkboxes" url_param="product_cat"]

And yes I understand I can put [wpv-found-count] with the view's loop, but it had been working within the filter as well until I added that code above to my functions file. I'm guessing that has caused it to not take effect in the Filter area any longer right?
==>
In order to ensure that the issue is due to the Toolset hook you added to your functions file, what if you try to disable that hook for a moment and check if you see it working, if yes, indeed that would be the cause.

#2817183

Thanks, this works, but is this really the way it's supposed to work? I have to remove a shortcode to get the query filter to show it's settings again... isn't this a serious bug?

I know legacy views isn't really worked on anymore, but so many of us still use it. Really wish Toolset revisited this.

Tim

#2817198

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Thanks, this works, but is this really the way it's supposed to work? I have to remove a shortcode to get the query filter to show it's settings again... isn't this a serious bug?
===>
Yes - this is known and we alerady have internal ticket for that but we have other major issues to work on. The fix will be made available in future but there is no ETA on it.