Skip Navigation

[Resolved] Different search fields per product categorie

This support ticket is created 6 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 2 replies, has 2 voices.

Last updated by troyC 6 years, 6 months ago.

Assisted by: Nigel.

Author
Posts
#696302

Tell us what you are trying to do?

I am trying to add different search options per product categorie. Can you give me advise on how its best to achieve this?

Is there a similar example that we can see?

I have added the code to the archive of products. By selecting "Let me choose individual settings manually" under "How do you want to update the results?" i have almost achieved when I want to accomplish. The only problem with this is that it does not include a label above each search field

What is the link to your site?
I have tested here hidden link

Any advise would be highly appreciated.

#696514

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Hi Troy

You could make a product category archive that includes all of the possible filter controls that you may want to appear on any one of the archives on the front-end.

Then wrap the markup for the filter controls in conditional statements to only display for certain categories.

You can use the shortcode wpv-archive-title to know the currently displayed archive: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-archive-title

Note that the format output is something like "Category: Hoodies". (This is from the demo content that comes with WooCommerce.)

So you can choose to only display a particular form control for such a category like so:

[wpv-conditional if="( '[wpv-archive-title]' eq 'Category: Hoodies' )"]
<div class="form-group">
	<label>[wpml-string context="wpv-views"]Product color[/wpml-string]</label>
	[wpv-control-post-taxonomy taxonomy="pa_color" type="select" url_param="wpv-pa_color"]
</div>
[/wpv-conditional]

You can also choose to display a filter control if the category is NOT the specified one, and you can combine conditions as required.

(See https://toolset.com/documentation/user-guides/conditional-html-output-in-views/ for details about using conditional shortcodes.)

#713144

Thank you very much.