Hi ciaran ,
I was doing something similar over the last week, so I can help with this.
If you’re on single location – From the admin screen, on the left panel menu, go to Restaurant, Settings, and Settings again (in the menu that appears at the top).
Under Offer Reservations, set time interval and stay time to 120 minutes (2 hours) and save.
Next, from the left panel menu, go to Design, Themes, Edit the Template of your Active Child Theme.
Under templates, select pages from the first dropdown and from the second dropdown select Reservation [reservation/reservation].
Click on the Booking Component, and change “The interval to use for the time picker” to 120.
No need to worry about “The interval to use for the time slots”, as we’re going to be getting rid of the time slots later.
Still with me?
Great!
Let’s keep going, almost done.
Now you need to access the files on your host, and navigate to:
extensions/igniter/reservation/components/Booking.php (thanks @ryanmitchell !)
Edit the below (should be around line 200) by setting the start time to (17, 00, 00) and end time to (21, 59, 59) (so that the last time available is 21:00).
`public function getTimePickerOptions()
{
$options = [];
$startTime = Carbon::createFromTime(00, 00, 00);
$endTime = Carbon::createFromTime(23, 59, 59);
$interval = new DateInterval("PT{$this->property('timePickerInterval')}M");
$dateTimes = new DatePeriod($startTime, $interval, $endTime);
foreach ($dateTimes as $dateTime) {
$options[$dateTime->format('H:i')] = Carbon::parse($dateTime)->isoFormat($this->timeFormat);
}
return $options;
}`
For the last part, hiding the timeslots – The best way I could work out, was to only show 1 time slot (so there is probably a better way – but this is the best I’ve got):
Still on the files on your host, navigate to:
extensions/igniter/reservation/classes/BookingManager.php
Now you’re going to edit the below (around line 70) by setting the start “$interval * 2” to “$interval * 0” and the end “$interval * 3” to “interval * 1” – This will make it so only the time they selected in the dropdown shows up.
{
if (!$this->location)
return [];
$start = $date->copy()->subMinutes($interval * 2);
$end = $date->copy()->addMinutes($interval * 3);
$dateInterval = new DateInterval('PT'.$interval.'M');
$dateTimes = new DatePeriod($start, $dateInterval, $end);
return $dateTimes;
}
Bob’s your uncle, you’re done.
You should now only have 3 options from the dropdown – 17:00; 19:00; & 21:00;
And depending which one the customer picks, they will only have that option from the time slots, almost like a confirmation page .
Hope it helps.
Test it out, make sure there are no errors.
Let me know if you need any help with this.
All the best!