Skip Navigation

[Resolved] Merge search metafields

This support ticket is created 6 years, 3 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.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#611570

Hello
I have a view wich display travel combined quotation s, a combined quotation is based on 2 or 3 destinations
I have a 3 metafields (country1,country2,country3) associated with this quotation in wich are stored the destinations
I want to search this view by country but I don't want to have 3 selectboxes : country1, country2, country3
I want only 1 selectbox field wich display countries and when i select a country it returns the corresponding quotation

Thank you for your help

#611672

Hello,

I think it is possible within Views plugin, but there is a problem is in the "countries select box field" of custom search form,
In the Views custom search form, we use shortcode [wpv-control-postmeta] to generate the field search field, it will only get existed data from only one custom field instead of all three custom fields.

I suggest you setup all options manually, for example:
[wpv-control-postmeta field="wpcf-country1" type="select" source="custom" url_param="wpv-country-code" values="us,uk,fr" display_values="USA,UK,France"]

It will be able to pass URL parameter "wpv-country-code" to the view, and you can filter the view by URL parameter "wpv-country-code", for example:
Select items with field:
wpcf-country1 is a string like URL_PARAM(wpv-country-code)
OR
wpcf-country2 is a string like URL_PARAM(wpv-country-code)
OR
wpcf-country3 is a string like URL_PARAM(wpv-country-code)

More help:
wpv-control-postmeta
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-postmeta
Filtering Views Query by Custom Fields
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.