Skip Navigation

[Resolved] Operating Hours

This support ticket is created 6 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
- 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 10 replies, has 2 voices.

Last updated by Nigel 6 years ago.

Assisted by: Nigel.

Author
Posts
#1143590

Hi Nigel, good day.

I have this filters for my directories

Monday Open time : [ options]
Monday Close Time : [ options]

i need two step here

1. there should be checkbox for [open on Mondays] - conditional if value of monday-open is not empty
2. once selected it should display the two options to select time.

Monday Open time: Monday Close time:

How do i approach this please.

#1143613

working site is here:hidden link

#1143704

Nigel
Supporter

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

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

Hi Dee

In words what is the intention here?

On the one hand there is setting up the data and entering it for the business listings (e.g. adding their opening hours).

On the other hand there is searching for businesses, including hours of business in the filters.

For the search filters, is it right that you want users to search by a range? Rather than by an individual value (e.g. show businesses that are open at 9pm)?

Imagine you have a business and you set it up so that its Monday hours of business are 9am to 9pm.

So there would be a custom field monday-from and another monday-to.

A user might search for businesses open at 10pm, and that is what they choose from the filter.

Your search View can include a filter where the chosen time is greater than monday-from AND less than monday-to (which our example business would fail and so be excluded).

If you want users to enter a range in the filter I'm not sure how you would expect that to work.

Say someone enters 7pm to 10pm as the range.

7pm would be compared to monday-from (should be later) and 10pm should be compared to monday-to (should be earlier). Or maybe you have something else in mind?

Once you start to allow for the possibility that businesses might have split hours in a day (e.g. open for 3 hours at lunchtime, and again for 5 hours in the evening), plus holidays, then this becomes very complicated and would require a bespoke solution that I can't really help you with. I would point out that there are plugins dedicated to this very issue which you could find helpful (search for "wordpress plugin opening hours").

#1143783

Hi Nigel

The custom field is created, even thought there is many of the same kind .
something like Monday start hours, Monday close hours. .... for whole week, plus a repeating field for other operating hours.

my approach is not that complicated, no need for the split hours, but yes that's a good to consider too.
I will look at the plugin approach too.

the options for filters and custom fields are set manually . exp : 7:00 am , 7:30 am , etc.

#1143885

Hi Nigel. i see your thread here:https://toolset.com/forums/topic/opening-hours/

you mention there cred form does not support repeat field YET , is this the same case still ?

#1143889

Nigel
Supporter

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

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

Hi Dee

That's right, updating the workflow with Forms to match that available on the backend is a work-in-progress, and isn't expected to be completed for some time.

So adding repeatable field groups is akin to adding child posts, requiring a form to publish a group of repeating fields that includes a parent selector to identify which post they belong to. See https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/front-end-forms-for-repeatable-field-groups/

In your previous reply you didn't answer my question about how the filters are intended to work, whether you are looking to specify a specific time in the filter which is then compared to the opening and closing fields of the posts, or whether you intend users to enter a range, and how that should work.

#1143890

Hi Nigel

i am good to choose either one , whichever simple. whats your view pls .

#1143894

The plugin method doesn't work for me for now. i guess it require some heavy custom coding still.

#1143907

Nigel
Supporter

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

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

openinghours.gif
Screenshot 2018-11-09 at 16.20.06.png

OK, so I'm not sure why the checkbox for open on Mondays you mention in your first post is required.

The straightforward implementation of this would be to

add the following custom fields to your listing posts:

monday-open
monday-close
tuesday-open
tuesday-close
wednesday-open
wednesday-close
etc.

When editing a Listing, values can be provided for days where it makes sense (i.e. when open) and left blank when not.

Then it is simply a question of setting up the filters correctly in the View.

Not to simplify things with my test, my custom fields are numeric fields and I'm entering the times in 2400 format (you might want to use a select dropdown with options where the display values are 07:00, 07:30 etc. but for comparison purposes the stored values should be numbers (e.g. 0730).

Now, we need to use one filter control (users will enter a single time) to compare against both the open and close time (repeating this for each day).

So, I inserted a filter control for monday-open and edited the URL parameter to omit -open, because I'm going to use it for both -open and -close fields.

I then edited the resulting Query Filter directly (if you can't see that, go to the Screen Options at the very top of the page to expose it).

There was already a filter inserted for monday-open. I added another filter for monday-close using the same URL parameter and edited them both for the comparisons required. See my screenshot.

You can see the results in the screen recording. It's is very crude because my filter control is just a text box to type in a number, and you will use a select dropdown with options for 11:00, 11:30, 12:00 etc.

#1144413

Hi nigel, after much considerations, i decided not to create filter for the operating hours, iNstead just give a checkbox for "open now" allow user to search by the current operating places etc,

i beleive the approach is somehow simliar with your above method. will post if any hiccups. thanks.

#1145055

Nigel
Supporter

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

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

OK, let me mark this as awaiting feedback from you.