Skip Navigation

[Resolved] Search for

This support ticket is created 5 years 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/Karachi (GMT+05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Waqar 5 years ago.

Assisted by: Waqar.

Author
Posts
#1221827

Edit: Sorry for the pointless title :-/ It should be "Search for values in child posts but show parent post"

Hi there

We build a website for a travel agency. They offer multiple tours. The tours are a CPT called "Tours".

To each tour, we need to assign dates with prices. We thought of making a new CPT named "Dates". We planned to connect the dates with the tours by using a relationship (one-to-one). First question: is that the correct way to do it or is there another better option?

Second question: We would like to integrate a search view that allows to search for dates. In the results, it should display the tours that have related posts that lie within the selected range. Is that possible to achieve?

Thank your very much for your help.

Best,
Marcial

#1222216

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Marcial,

Thank you for contacting us and I'll be happy to assist.

> To each tour, we need to assign dates with prices. We thought
> of making a new CPT named "Dates". We planned to connect
> the dates with the tours by using a relationship (one-to-one).
> First question: is that the correct way to do it or is there
> another better option?

- Using a separate CPT for dates is one way of doing this, but it is not the most natural way. It will mean that you'll not be using Toolset's own date field and date filtering features and you'll end up doing more work than necessary.

A simple way would be to use two "Date" type fields (one for the start and the other for the end), directly attached to the CPT "Tours".

> Second question: We would like to integrate a search view that
> allows to search for dates. In the results, it should display the
> tours that have related posts that lie within the selected range.
> Is that possible to achieve?

- Once you'll have the tour's start and end date stored as custom field values in its own CPT, it would be possible to create custom search form in the view to include a date range picker.
( ref: https://toolset.com/documentation/user-guides/date-filters/ )

Visitors will be able to use that to see only tours, where the start and end dates fall inside the selected date range.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

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