/home
/deploy
/EHungry-2-vlad
/Web
/classes
/Cart.class.php
}
public function getFeeOptionId($fee) {
return $this->fee_options[$fee->id];
}
public function getFeeOption($fee) {
return $this->fee_options[$fee->id] ? new FeeOption($this->fee_options[$fee->id]) : null;
}
public function setFeeOption($fee, $option) {
$this->fee_options[$fee->id] = $option->id;
}
/**
* Get the restaurant's additional fees that are applied to the cart.
* @param Restaurant $restaurant
* @return Fee[]
*/
public function getFees(Restaurant $restaurant) {
$restaurantFees = Fee::getAllForRestaurant($restaurant);
$fees = [];
foreach ($restaurantFees as $fee) {
if ($fee->enabled && ($fee->order_types & constant($this->getBaseOrderType()))
&& (!$fee->cc_orders_only || $this->getIsPaymentMethodACard())) {
$fees[] = $fee;
}
}
return $fees;
}
/**
* @param Fee $fee
* @return int
*/
public function getFeeTotal($fee) {
if ($fee->cc_orders_only && !$this->getIsPaymentMethodACard()) {
return 0;
}
return $fee->getFeeTotal($this->getFeeOption($fee), $this->subTotal, $this->total);
Arguments
"Too few arguments to function Cart::getFees(), 0 passed in /home/deploy/EHungry-2-vlad/Web/classes/BaseClass.class.php on line 521 and exactly 1 expected"
/home
/deploy
/EHungry-2-vlad
/Web
/classes
/BaseClass.class.php
public function setCreatedAt($value) {
return parent::setAttribute(static::CREATED_AT, $value);
}
/**
* Sets the updated_at field, with a backport of the 5.5+ behavior for disabling that field.
* @param mixed $value
* @return EloquentModel
*/
public function setUpdatedAt($value) {
if (static::UPDATED_AT) {
parent::setAttribute(static::UPDATED_AT, $value);
}
return $this;
}
public function getAttribute($key) {
//first we check for mutated getters
if ($getter = $this->findAnyGetMutator($key)) {
return $this->$getter();
}
if (in_array($key, $this->fields()->getFields()) || array_key_exists($key, $this->attributes)) {
//this is an existing database field or came from a custom query, so let's get it as an attribute
return parent::getAttribute($key);
} elseif ($this->relationLoaded($key) || method_exists($this, $key)) {
//this is a relationship method, skipped at getAttribute() by the last if-clause, so let's call it here
try {
return $this->getRelationValue($key);
} catch (LogicException $e) {
throw new LogicException('You probably forgot to *return* from your relation method - or accidentally triggered a relation getter where you shouldn\'t', $e->getCode(), $e);
}
} elseif (property_exists($this, $key)) {
//support for legacy getter of custom props
return $this->$key;
} else {
//probably a custom prop (sometimes used in legacy code), so let's get it directly from the object as usual
//this causes a small side-effect where isset() can't be used with undeclared custom props; property_exists() should be used instead (actually, they should be declared lol)
if (DevLevel > 0) {
trigger_error('Custom property got from '.static::class.": $key", E_USER_NOTICE);
/home
/deploy
/EHungry-2-vlad
/PHP
/vendor
/illuminate
/database
/Eloquent
/Model.php
*
* @param int $perPage
* @return $this
*/
public function setPerPage($perPage)
{
$this->perPage = $perPage;
return $this;
}
/**
* Dynamically retrieve attributes on the model.
*
* @param string $key
* @return mixed
*/
public function __get($key)
{
return $this->getAttribute($key);
}
/**
* Dynamically set attributes on the model.
*
* @param string $key
* @param mixed $value
* @return void
*/
public function __set($key, $value)
{
$this->setAttribute($key, $value);
}
/**
* Determine if the given attribute exists.
*
* @param mixed $offset
* @return bool
*/
Arguments
/home
/deploy
/EHungry-2-vlad
/Web
/eds
/ordering
/order.php
}
}
private static function additionalFeeRow($order, \Restaurant $restaurant) {
if ($order->additional_fee > 0) {
return [
'name' => ($restaurant->per_order_surcharge_name
? ($restaurant->per_order_surcharge_name . ($restaurant->per_order_surcharge_type == 2
? " ($restaurant->per_order_surcharge%)"
: ''
))
: 'Online Ordering Fee'
),
'value' => $order->additional_fee,
];
}
}
private static function taxableFeeRows($order) {
return $order->fees
->filter(function ($fee) {
return $fee->is_taxable;
})
->map(function ($fee) {
return ['name' => $fee->fee_option_name, 'value' => $fee->fee];
})
->toArray();
}
private static function nonTaxableFeeRows($order) {
return $order->fees
->filter(function ($fee) {
return !$fee->is_taxable;
})
->map(function ($fee) {
return ['name' => $fee->fee_option_name, 'value' => $fee->fee];
})
->toArray();
}
Arguments
/home
/deploy
/EHungry-2-vlad
/Web
/eds
/ordering
/order.php
public static function rows(\Account $account, $order, \Restaurant $restaurant, ?bool $should_group_taxes_and_fees = null) {
// Coupon
$coupon = $order->coupon_id ? new \Coupon($order->coupon_id) : null;
// Group taxes and fees
if ($should_group_taxes_and_fees === null) {
$should_group_taxes_and_fees = $restaurant->getGroupFeesInsideTheCart();
}
// Assemble rows
return array_filter(array_merge(
[static::subtotalRow($order)],
$restaurant->delivery_charge_is_taxable ? [static::deliveryRow($order, $restaurant)] : [],
$coupon && $coupon->can_be_used_for !== \Coupon::CAN_BE_USED_FOR_EVERYTHING ? static::couponRows($coupon, $order) : [],
$should_group_taxes_and_fees
? static::tipFeeRows($order, $restaurant)
: array_merge(
$restaurant->additional_fee_taxable ? [static::additionalFeeRow($order, $restaurant)] : [],
static::taxableFeeRows($order),
$restaurant->is_bag_fee_taxable ? [static::bagFeeRow($order)] : [],
[static::taxesRow($order)]
),
!$restaurant->delivery_charge_is_taxable ? [static::deliveryRow($order, $restaurant)] : [],
// $should_group_taxes_and_fees
// ? [
// static::taxesAndFeesRow($account, $order, $restaurant),
// static::tipRow($order),
// ]
// : array_merge(
// !$restaurant->additional_fee_taxable ? [static::additionalFeeRow($order, $restaurant)] : [],
// static::nonTaxableFeeRows($order),
// !$restaurant->is_bag_fee_taxable ? [static::bagFeeRow($order)] : [],
// [static::tipRow($order)],
// [static::ccFeeRow($order, $restaurant)]
// ),
$coupon && $coupon->can_be_used_for === \Coupon::CAN_BE_USED_FOR_EVERYTHING ? static::couponRows($coupon, $order) : []
));
}
Arguments
/home
/deploy
/EHungry-2-vlad
/Web
/checkout
/cart.php
: ''
),
];
}, $item->getAddons()),
'after' => $item->special_instructions
? \EDS\Icon(['icon' => 'sparkle', 'color' => 'default']) . "Special instructions: $item->special_instructions"
: null,
];
}, $cart->getCartItems());
$coupon = $cart->getCoupon();
if ($coupon && $coupon->includes_free_item && $cart->coupon_free_item) {
$items[] = [
'name' => $cart->coupon_free_item,
'price' => 0,
'after' => "Coupon: {$coupon->getDisplayCode()}",
];
}
$rows = \EDS\Order::rows($account, $cart, $restaurant, $props['is_checkout']);
?>
<form
id="cart-form"
data-async-on-event="cart_item_updated"
data-async-block="none"
method="post"
action="<?=getUrl('/checkout/cart/items')?>"
data-async-swap="none"
<?=\EDS\stringify_attrs(\EDS\omit($attrs, array_keys($props)))?>
>
<script>
$(() => $('#cart-form').stickySidebar('updateSticky'));
</script>
<input type="hidden" name="is_checkout" value="<?=$props['is_checkout'] ? 1 : 0?>" />
<?=\EDS\CartHeader([
'count' => $number_of_cart_items,
'close' => $props['is_checkout']
Arguments
Account {}
Cart {}
Restaurant {}
false
/home
/deploy
/EHungry-2-vlad
/Web
/templates4.0
/customer
/cart.php
<? // TODO: Expand cart to full height, but also stick it with `stickySidebar` ?>
<aside
id="cart-right-side"
style="grid-area: cart"
data-event-on:show_cart="$(this).addClass('is-shown').one('transitionend', () => $(document.body).css({ overflow: 'hidden' }))"
data-event-on:hide_cart="$(this).removeClass('is-shown').one('transitionend', () => $(document.body).css({ overflow: '' }))"
data-async-on-event="reload_cart"
data-async-block="none"
data-async-method="get"
data-async-action="<?=\eHungry\Services\Account::getUrl('/checkout/cart')?>"
data-async-form=".your_order"
data-async-swap="none"
data-event-on:document_ready="$(this).find('.your_order').stickySidebar({ topSpacing: <?=$header_height?>, bottomSpacing: 0, minWidth: 991 })"
>
<?=\Checkout\CartRoutes::cart(
['class' => 'your_order d-flex flex-column h-100', 'is_checkout' => $is_checkout_cart, 'items_expanded' => true, 'totals_expanded' => $is_checkout_cart],
[],
$account,
$cart,
$restaurant
)?>
</aside>
<?
return;
}
$_SESSION['redirect_form'] = "checkout";
$cart->calculateSubtotal();
if (!$account->getSetting(\Setting::ACCOUNT_SHOW_TIPS_FORM_IN_CHECKOUT)) {
$cart->setDefaultTip($restaurant, $handler);
}
$total = $cart->calculateTotal($restaurant, $company ?? null, $customer ?? null);
$cartItemCount = $cart->getCartItemCount();
$is_checkout_cart = $_REQUEST['form'] == 'checkout' || $_REQUEST['checkout'] == 'true';
?>
<aside
id="cart-right-side"
class="checkout_orderbox <?=$_REQUEST['form'] === 'ajaxcart' && $_GET['cartaction'] !== 'add' && !$_GET['coupons'] ? 'is-shown' : ''?>"
Arguments
array:4 [
"class" => "your_order d-flex flex-column h-100"
"is_checkout" => false
"items_expanded" => true
"totals_expanded" => false
]
[]
Account {}
Cart {}
Restaurant {}
/home
/deploy
/EHungry-2-vlad
/Web
/view4.0
/customer
/category.php
data-async-on-event="menu_selected"
data-async-block="this"
data-async-method="get"
data-async-action="<?=htmlentities(getSecureHost() . 'ajax/?form=menu_items')?>"
data-async-then="(data) => {
app.event.emit('menu_items_loaded');
if (data.category_id != null) {
app.event.emit('category_selected', { id: data.category_id });
}
}"
>
<?=$menuPageFragment?>
</div>
</div>
</div>
</div>
</div>
</div>
</main>
<? include(CORE_PATH. 'templates4.0/customer/cart.php'); ?>
<input type="hidden" id="hid-category-id" value="<?=$category->id?>" />
<div class="hidden" id="upsell-source">
<? include(CORE_PATH. 'templates4.0/customer/cartupsell.php'); ?>
</div>
<?
if (!empty($_REQUEST['item_id'])) {
$item = new MenuItem($_REQUEST['item_id']); ?>
<script>
// load menu item when it's a menu item page url - for `history.pushState()`
$(() => {
$('#add_menu_item').modal('show');
loadMenuItem(<?=$item->id?>, <?=$_REQUEST['price_id'] ?: 'null'?>, null, <?=$menu->id?>, <?=$category->id?>);
});
</script>
<? } ?>
<script>
Arguments
"/home/deploy/EHungry-2-vlad/Web/templates4.0/customer/cart.php"
/home
/deploy
/EHungry-2-vlad
/Web
/view4.0
/customer
/ordering3.php
<?
switch ($_REQUEST['ordering_level']) {
case OrderingLevel::NONE:
App::debugbarTime($timerLevel = 'ordering3: locationlist');
include(CORE_PATH . 'templates4.0/customer/locationlist.php');
break;
case OrderingLevel::RESTAURANT:
case OrderingLevel::MENU:
App::debugbarTime($timerLevel = 'ordering3: menu');
include(CORE_PATH . 'view4.0/customer/menu.php');
break;
case OrderingLevel::CATEGORY:
App::debugbarTime($timerLevel = 'ordering3: category');
include(CORE_PATH . 'view4.0/customer/category.php');
break;
case OrderingLevel::ITEM:
case OrderingLevel::PRICE:
App::debugbarTime($timerLevel = 'ordering3: menuitem');
include(CORE_PATH . 'view4.0/customer/category.php');
break;
}
if (isset($timerLevel)) {
App::debugbarTime($timerLevel);
}
Arguments
"/home/deploy/EHungry-2-vlad/Web/view4.0/customer/category.php"
/home
/deploy
/EHungry-2-vlad
/Web
/controllers
/customer.php
if (!in_array($_REQUEST['form'], ['checkout', 'nosuchpage', 'validatecallback', 'viewdeliveryzone'])) {
//TODO: probably need to add one more form here that is called ajax, callback seems to reset when it shouldnt
unset($_SESSION['validation_data']);
}
$locs = $account->getActiveRestaurants('position');
$tab = MainNavigationTab::getAllForAccount($account->getId());
include_once(CORE_PATH.'lib/helpers/customer3.0.php');
if (!in_array($_REQUEST['form'], $viewContentOnly)) {
App::debugbarTime('header');
include_once(getLayoutPartPath('header'));
App::debugbarTime('header');
}
App::debugbarTime("view '{$_REQUEST['form']}'");
$path = CORE_PATH.'view' . ($_REQUEST['_VERSION'] == 4 ? 4 : 3) . '.0/customer/'.$_REQUEST['form'].'.php';
if (is_readable($path)) {
include_once($path);
}
App::debugbarTime("view '{$_REQUEST['form']}'");
if (!in_array($_REQUEST['form'], $viewContentOnly)) {
App::debugbarTime('footer');
include_once(getLayoutPartPath('footer'));
App::debugbarTime('footer');
}
function getLayoutPartPath($part) {
if (isset($_REQUEST['_CORDOVA_APP']) && $_REQUEST['_VERSION'] != 4) {
$cart = Cart::getCurrent();
//FIXME: it's technically possible to end up with $template = null
if (!$_REQUEST['contentonly']) {
$template = !isset($_REQUEST["altdoc"])? "app/$part" : "app/alt$part";
}
} else {
$template = !isset($_REQUEST["altdoc"])? "customer/$part" : "customer/alt$part";
}
Arguments
"/home/deploy/EHungry-2-vlad/Web/view4.0/customer/ordering3.php"
/home
/deploy
/EHungry-2-vlad
/Web
/index.php
App::startTime();
ErrorHandlers::register();
// Global.php is the core setup file for the application
App::debugbarTime('Global.php');
require(dirname(__DIR__) . '/PHP/Global.php');
App::debugbarTime('Global.php');
/** @var string $controller The main controller - defined at /PHP/Global.php */
App::debugbarTime('Sentry - controller');
ErrorHandlers::sentryInit($controller); //doesn't always do much - not every controller has a Sentry project
App::debugbarTime('Sentry - controller');
App::debugbarTime("controller: $controller");
apache_note('AppController', $controller);
if (file_exists(CORE_PATH."lib/helpers/$controller.php")) {
require CORE_PATH."lib/helpers/$controller.php";
}
require CORE_PATH."controllers/$controller.php";
App::debugbarTime("controller: $controller");
Arguments
"/home/deploy/EHungry-2-vlad/Web/controllers/customer.php"