Mealtimes

Created by:  Ryan Mitchell
 87

Extend mealtimes to work on specific days and date ranges

 Extension
Version
v1.5
Updated
1 month ago
Published
3 months ago
Author
Ryan Mitchell

Views: 640

Extend Mealtimes to become Meal Schedules

Extends mealtimes to allow for menu scheduling and different menus on different days.

After Installation

Change the following PHP file:

extensions/igniter/cart/classes/CartManager.php

!$menuItem->isAvailable() needs to become !$menuItem->isAvailable($this->location->orderDateTime())

If you are using the tastyigniter-orange theme you need to amend partials/localMenu/item.php as follows:

$mealtimeNotAvailable = ($mealtime AND !$mealtime->isAvailableNow());

becomes

$mealtimeNotAvailable = true;
$mealtimes->each(function($mealtime) use (&$mealtimeNotAvailable, $location){
    if ($mealtime->isAvailableSchedule($location->orderDateTime()){
        $mealtimeNotAvailable = false;
    }
});

Note: this will mean any menu items without a mealtime will also be unavailable.

If you want the menu option to be hidden when unavailable, then wrap the HTML output in

if ($mealtimeNotAvailable == false){ }

i.e.

if ($mealtimeNotAvailable == false){

?>

....

<?php } ?>

Releases

  1.   Latest release
    1.5

  2. 1.4.1

  3. 1.4

    Marketplace push

  4. v1.3

    Bug fixes on beta 22 and marketplace push