- Edward Parker(Private) October 15, 2020 at 7:16 pm #263056
I successfully added a S&F filter to a Beaver Builder posts module, and it works well. Now, I want to have additional search options for the same posts module.
Description: I’m working on a hotel site. I currently have a slider to filter based on price (selecting from a Field Group A number field), but I would like to add two more filters: one for room amenities (selecting from Field Group B radio button fields), and one for extras (selecting from Field Group C radio button fields).
All these filters should work together to provide results from the same pool of rooms. Is this possible with BB, or must I do it in PHP?Trevor Moderator(Private) October 16, 2020 at 9:09 am #263103
There is no reason you cannot add these to your existing search form (you can have only one form, but it can have multiple fields) as long as you have a separate data source for each of these facets you need to filter on. The filter fields will work together, so, for example, you could search for a hotel that has balconies and one that has a sea view, provided. I would have suggested that Room Amenities be a checkbox field to allow multiple choices, and maybe the same for the extras field.Edward Parker(Private) October 16, 2020 at 6:30 pm #263211
Thanks Trevor, that makes perfect sense. Unfortunately, despite having tried many settings combinations, I haven’t got it working yet. I want it to work like your “Movies” demo:
My fields are defined using ACF. When you say “one form, but it can have multiple fields”, do you mean that I should use multiple “Post Meta” fields (ie: one for “Swimming Pool”, one for “Kitchen”, etc.)? If I choose “Automatically” under “get options”, it works, but on the page I see a Bicycle Rental heading with both “Yes” and “No” boxes under it:
If I change it to “Manual” and set “Value” to “Yes and “Label” to “Bicycle Rental”, it displays better, but doesn’t actually filter correctly.
If I’m using one Post Meta field for all amenities, what meta key should be used? If I use different Post Meta fields for each amenity, how I make them organise like in screenshot A?
No doubt I’m close, but some logic is eluding me. I’m gladly read some more detailed documentation if any is available.
E.Edward Parker(Private) October 20, 2020 at 5:48 pm #263540
Thanks very much for looking and replying. You are indeed right – I started out with room_rate and later changed it to nightly_rate, but forgot to change it in the form. I should have noticed that!
While that was a problem, it wasn’t actually what I was struggling with though (which was trying to get amenities such as bicycle, swimming pool, etc. under a single heading). However, thanks to you getting me to thinking differently about my ACF fields, I figured it out.
The trouble was, I had each of my amenities in ACF as a separate field within a field group, where I should have had them all as options within a single field in a field group. Once I made that change, it worked correctly.
But of course, if you hadn’t pointed out the other problem that I didn’t know I had, I wouldn’t have succeeded at the field change.
Thanks for you help – I greatly appreciate it!
You must be logged in to reply to this topic.
Our support hours are:10am - 5pm (GMT), Monday - Friday
Please be aware that tickets opened over the weekend will looked at on Monday.