本文整理汇总了PHP中Basket::getTotal方法的典型用法代码示例。如果您正苦于以下问题:PHP Basket::getTotal方法的具体用法?PHP Basket::getTotal怎么用?PHP Basket::getTotal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Basket
的用法示例。
在下文中一共展示了Basket::getTotal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: switch
switch ($action) {
case 'addPersonal':
Basket::addEvent($event);
redirect('basket.php', 'Ticked added', false, 1);
case 'delete':
Basket::removeEvent($event, $_REQUEST['user']);
redirect('basket.php', 'Ticket removed', false, -1);
}
}
$signupableEvents = Events::getSignupableEvents();
$tpl->assign('signupableEvents', $signupableEvents);
$formAddToBasket = new FormAddToBasket($signupableEvents);
if ($formAddToBasket->validate()) {
$formAddToBasket->process();
redirect('basket.php', 'Ticket added to basket');
}
$tpl->assign('addToBasketHasEvents', $formAddToBasket->hasEvents);
$tpl->assignForm($formAddToBasket, 'addToBasket');
$formPayForFriend = new FormPayForFriend($signupableEvents);
if ($formPayForFriend->validate()) {
$formPayForFriend->process();
redirect('basket.php', 'Ticked added for friend.');
}
$tpl->assignForm($formPayForFriend, 'payForFriend');
$tpl->assign('basketItems', Basket::getContents());
$tpl->assign('basketTotal', Basket::getTotal());
$tpl->assign('basketIsEmpty', Basket::isEmpty());
require_once 'includes/widgets/header.php';
require_once 'includes/widgets/sidebar.php';
$tpl->display('basket.tpl');
require_once 'includes/widgets/footer.php';
示例2: redirect
<?php
require_once 'includes/common.php';
require_once 'includes/classes/Basket.php';
require_once 'includes/classes/Events.php';
use libAllure\Session;
use libAllure\Sanitizer;
if (!Session::isLoggedIn()) {
redirect('login.php', 'You must login to use the checkout!');
}
if (Basket::isEmpty()) {
redirect('basket.php', 'You cannot go to the checkout with an empty basket!');
}
$sanitizer = new Sanitizer();
$cost = Basket::getTotal();
switch ($sanitizer->filterString('action')) {
case 'cash':
$f = new FormPayTicketCash();
if ($f->validate()) {
$f->process();
foreach (Basket::getContents() as $ticket) {
Events::setSignupStatus(Session::getUser()->getId(), $ticket['eventId'], 'CASH_IN_POST');
}
Basket::clear();
redirect('account.php', 'Thanks, you will be marked as PAID by an admin when they receive the cash.');
}
require_once 'includes/widgets/header.php';
$f->addElementHidden('action', 'cash');
$tpl->assignForm($f);
$tpl->display('form.tpl');
require_once 'includes/widgets/footer.php';