當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Basket::getTotal方法代碼示例

本文整理匯總了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';
開發者ID:CWFranklin,項目名稱:lan-party-site,代碼行數:31,代碼來源:basket.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';
開發者ID:CWFranklin,項目名稱:lan-party-site,代碼行數:31,代碼來源:checkout.php


注:本文中的Basket::getTotal方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。