当前位置: 首页>>代码示例>>PHP>>正文


PHP Basket类代码示例

本文整理汇总了PHP中Basket的典型用法代码示例。如果您正苦于以下问题:PHP Basket类的具体用法?PHP Basket怎么用?PHP Basket使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Basket类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: basket

 function basket()
 {
     if ($_POST) {
         $basket = new Basket();
         $basket->toOrder();
         $this->redirect('/cabinet/basket/thanks/');
     } else {
         if (Funcs::$uri[2] == 'delivery') {
             $seo['seo_title'] = 'Условия доставки';
             Funcs::setMeta($seo);
             $basket = new Basket();
             $data['order'] = $basket->getOrder();
             $data['delivery'] = $basket->getDelivery($data['order']);
             View::render('cabinet/delivery', $data);
         } elseif (Funcs::$uri[2] == 'thanks') {
             $seo['seo_title'] = 'Благодарим вас за заказ!';
             Funcs::setMeta($seo);
             View::render('basket/thanks');
         } else {
             $data['seo_title'] = 'Корзина';
             Funcs::setMeta($data);
             $basket = new Basket();
             $data['order'] = $basket->getOrder();
             //$data['delivery']=$basket->getDelivery($data['order']);
             //$data['payment']=$basket->getOrder($data['order']);
             View::render('cabinet/basket', $data);
         }
     }
 }
开发者ID:sov-20-07,项目名称:billing,代码行数:29,代码来源:CabinetController.php

示例2: products

 /**
  * Process the Products
  *
  * @param Basket $basket
  * @return array
  */
 public function products(Basket $basket)
 {
     $products = [];
     foreach ($basket->products() as $product) {
         $products[] = ['sku' => $product->sku, 'name' => $product->name, 'price' => $product->price, 'rate' => $product->rate, 'quantity' => $product->quantity, 'freebie' => $product->freebie, 'taxable' => $product->taxable, 'delivery' => $product->delivery, 'coupons' => $product->coupons, 'tags' => $product->tags, 'discount' => $product->discount, 'category' => $product->category, 'total_value' => $this->reconciler->value($product), 'total_discount' => $this->reconciler->discount($product), 'total_delivery' => $this->reconciler->delivery($product), 'total_tax' => $this->reconciler->tax($product), 'subtotal' => $this->reconciler->subtotal($product), 'total' => $this->reconciler->total($product)];
     }
     return $products;
 }
开发者ID:janusnic,项目名称:basket,代码行数:14,代码来源:Processor.php

示例3: add

 public function add()
 {
     $this->template->title = 'Cart :: Add';
     $this->template->metaDescription = '';
     $this->template->content = View::factory('cart')->bind('cart', $cart);
     $p_id = $_POST['p_id'];
     $this->cart = $this->session->get('Basket');
     $cart = new Basket();
     $item = new Item();
     $item->id = $p_id;
     $cart->add($item);
     url::redirect('/cart');
 }
开发者ID:VinceOmega,项目名称:mcb-nov-build,代码行数:13,代码来源:cart.php

示例4: getPrice

 /**
  * 
  * @return float
  */
 public function getPrice(Basket $basket)
 {
     $items = $basket->getItems();
     $sumPrice = 0;
     /* @var $item Item */
     foreach ($items as $item) {
         $discount = $item->getProductDiscount();
         $discountPrice = $discount->getDiscountPrice($item);
         $discountAmount = $discount->getDiscountAmount($item);
         $sumPrice += $discountPrice * $discountAmount;
     }
     return $sumPrice;
 }
开发者ID:csiz0,项目名称:kata-base-php,代码行数:17,代码来源:Cashier.php

示例5: __construct

 public function __construct(Service $service)
 {
     $this->db = $db;
     //Выборка всех категорий для меню т.к. используются на всех страницах публичной части
     $this->category = $service->get('category_mapper')->getAll();
     $this->basket_info = Basket::getBasketInfo();
 }
开发者ID:lexdss,项目名称:shop,代码行数:7,代码来源:View.php

示例6: buildContent

 function buildContent()
 {
     $harmoni = Harmoni::Instance();
     $basket = Basket::instance();
     $basket->removeAllItems();
     RequestContext::locationHeader($harmoni->request->quickURL("basket", "view"));
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:7,代码来源:empty.act.php

示例7: indexAction

 public function indexAction()
 {
     $basket = Basket::getBasket();
     //При удалении товара
     if ($_GET['del_item']) {
         Basket::deleteProductFromBasket($_GET['del_item']);
     }
     //Подтверждеение заказа
     if ($_POST['confirm_order']) {
         //Для получеения общей суммы заказа
         $basket_info = Basket::getBasketInfo();
         //Создаем и заполняем доменный объект заказа
         $order = new Order();
         $order->id = uniqid();
         //ID (Primary Key) для заказов генерируем сами
         $order->user_id = intval($_SESSION['user_id']);
         $order->delivery = $_POST['delivery'];
         $order->pay = $_POST['pay'];
         $order->total_sum = $basket_info['total_sum'];
         $order->status = 'processing';
         //Статус по-умолчанию, "В обработке"
         $order->date = date('Y-m-d H:i:s', time());
         $order->products = $basket;
         //Сохраняем заказ
         $this->service->get('order_mapper')->save($order);
         //Очищаем корзину и редиректим
         Basket::cleanBasket();
         $_SESSION['message'] = 'Спасибо за покупку. Ваш заказ принят в обработку. Данные отправлены на почту';
         header('Location: /basket');
         exit;
     }
     $view_data['basket'] = $basket;
     $view_data['title'] = 'Корзина покупателя';
     $this->service->get('view')->render('basket.tpl.php', $view_data);
 }
开发者ID:lexdss,项目名称:shop,代码行数:35,代码来源:BasketController.php

示例8: execute

 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 5/5/06
  */
 function execute()
 {
     $harmoni = Harmoni::Instance();
     $basket = Basket::instance();
     $basket->removeAllItems();
     print $basket->getSmallBasketHtml();
     exit;
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:15,代码来源:emptyAjax.act.php

示例9: loadBasket

 public function loadBasket($id)
 {
     $model = Basket::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'Запись не найдена.');
     }
     if ($model->user_id !== Yii::app()->user->id) {
         $this->error403();
     }
     return $model;
 }
开发者ID:postfx,项目名称:fermion,代码行数:11,代码来源:BasketController.php

示例10: process

 public function process()
 {
     $sql = 'INSERT INTO finance_transactions (amount, description, timestamp, account) VALUES (:amount, :title, now(), :account) ';
     $stmt = DatabaseFactory::getInstance()->prepare($sql);
     foreach (Basket::getContents() as $basketItem) {
         $stmt->bindValue(':amount', $basketItem['cost']);
         $stmt->bindValue(':title', '(given cash) ' . $basketItem['title'] . ' ticket for ' . $basketItem['username']);
         $stmt->bindValue(':account', $this->getElementValue('username'));
         $stmt->execute();
         Events::setSignupStatus($basketItem['userId'], $basketItem['eventId'], 'CASH_IN_POST');
     }
 }
开发者ID:CWFranklin,项目名称:lan-party-site,代码行数:12,代码来源:FormPayTicketCash.php

示例11: actionView

 public function actionView($id)
 {
     self::validateAdmin();
     $order = Order::getOrderById($id);
     $productQuantity = json_decode($order['products'], true);
     $productId = array_keys($productQuantity);
     $products = Products::getProductlistById($productId);
     $totalPrice = Basket::getTotalPrice($products, $productQuantity);
     $total = array_sum($totalPrice);
     require_once ROOT . '/views/admin_order/view.php';
     return true;
 }
开发者ID:Evkazolinium,项目名称:Eshop_for_example,代码行数:12,代码来源:AdminOrderController.php

示例12: getAssets

 /**
  * Answer the assets to display in the slideshow
  * 
  * @return object AssetIterator
  * @access public
  * @since 5/4/06
  */
 function getAssets()
 {
     $assets = array();
     $repositoryManager = Services::getService("Repository");
     $basket = Basket::instance();
     $basket->clean();
     $basket->reset();
     while ($basket->hasNext()) {
         $assets[] = $repositoryManager->getAsset($basket->next());
     }
     $iterator = new HarmoniIterator($assets);
     return $iterator;
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:20,代码来源:browse_xml.act.php

示例13: buildContent

 /**
  * Build the content for this action
  * 
  * @return boolean
  * @access public
  * @since 4/26/05
  */
 function buildContent()
 {
     $actionRows = $this->getActionRows();
     $harmoni = Harmoni::instance();
     $harmoni->request->startNamespace("basket");
     $idManager = Services::getService("Id");
     $authZ = Services::getService("AuthZ");
     $basket = Basket::instance();
     $assetId = $idManager->getId(RequestContext::value("asset_id"));
     $basket->moveUp($assetId);
     $harmoni->request->endNamespace();
     RequestContext::locationHeader($harmoni->request->quickURL("basket", "view"));
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:20,代码来源:up.act.php

示例14: isAuthorizedToExecute

 /**
  * Check Authorizations
  * 
  * @return boolean
  * @access public
  * @since 9/27/05
  */
 function isAuthorizedToExecute()
 {
     $harmoni = Harmoni::instance();
     $authZ = Services::getService("AuthZ");
     $idManager = Services::getService("Id");
     $basket = Basket::instance();
     $basket->reset();
     $view = $idManager->getId("edu.middlebury.authorization.view");
     $this->_exportList = array();
     while ($basket->hasNext()) {
         $id = $basket->next();
         if ($authZ->isUserAuthorized($view, $id)) {
             $this->_exportList[] = $id;
         }
     }
     if (count($this->_exportList) > 0) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:adamfranco,项目名称:polyphony,代码行数:28,代码来源:export.act.php

示例15: update

 /**
  * Tells the wizard component to update itself - this may include getting
  * form post data or validation - whatever this particular component wants to
  * do every pageload. 
  * @param string $fieldName The field name to use when outputting form data or
  * similar parameters/information.
  * @access public
  * @return boolean - TRUE if everything is OK
  */
 function update($fieldName)
 {
     $idManager = Services::getService("Id");
     $ok = parent::update($fieldName);
     // then, check if any "buttons" or anything were pressed to add/remove elements
     $this->_addFromBasketButton->update($fieldName . "_addfrombasket");
     if ($this->_addFromBasketButton->getAllValues()) {
         $basket = Basket::instance();
         $basket->reset();
         while ($basket->hasNext()) {
             $assetId = $basket->next();
             $element =& $this->_addElement();
             $element['_assetId'] = new AssetComponent();
             $element['_assetId']->setParent($this);
             $element['_assetId']->setValue($assetId);
         }
         $basket->removeAllItems();
         $this->rebuildPositionSelects();
     }
     return $ok;
 }
开发者ID:adamfranco,项目名称:concerto,代码行数:30,代码来源:SlideOrderedRepeatableComponentCollection.class.php


注:本文中的Basket类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。