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


PHP Basket::getTotalSum方法代碼示例

本文整理匯總了PHP中Basket::getTotalSum方法的典型用法代碼示例。如果您正苦於以下問題:PHP Basket::getTotalSum方法的具體用法?PHP Basket::getTotalSum怎麽用?PHP Basket::getTotalSum使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Basket的用法示例。


在下文中一共展示了Basket::getTotalSum方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: getBasketInfo

 function getBasketInfo($d = array())
 {
     $data['basket'] = $this->getBasket();
     $order = $this->getOrderData();
     foreach ($data['basket'] as &$item) {
         if (isset($order['item_comment'][$item['key']])) {
             $item['item_comment'] = $order['item_comment'][$item['key']];
         }
     }
     if (!empty($d['refid'])) {
         ShopBonus::recountBasket($d['refid'], $data['basket']);
     }
     if (!empty($d['promo'])) {
         ShopBonus::recountBasket(ShopBonus::getPromoRefId($d['promo']), $data['basket']);
     }
     foreach ($data['basket'] as &$item) {
         if (isset($d['item_comment'][$item['key']])) {
             $item['item_comment'] = $d['item_comment'][$item['key']];
         }
     }
     $bsk = new Basket($data['basket']);
     //для всяких расчётов
     foreach ($d as $k => $v) {
         $data[$k] = $v;
     }
     $delivery_zone = 0;
     if (isset($d['delivery_zone'])) {
         $delivery_zone = (int) $d['delivery_zone'];
     }
     //Если есть для города доставка
     //		$data+=$this->getDeliveryCost($bsk->getSum());
     //Если есть зоны доставка
     $data += $this->getDeliveryCostZone($bsk->getSum(), $delivery_zone);
     //		$data['delivery']=0;
     //		$data['price_condition']=0;
     //		if(isset($cityProp['price'])){
     //			$data['delivery']=$cityProp['price'];
     //			if($cityProp['price_condition']){
     //				$data['price_condition']=$cityProp['price_condition'];
     //			}
     //			if($cityProp['price_condition'] && $bsk->getSum()>$cityProp['price_condition']){
     //				$data['delivery']=0;
     //
     //			}
     //		}
     $data['margin'] = 0;
     //		if(isset($cityProp['margin'])){
     //			$data['margin']=$cityProp['margin'];
     //		}
     //но есть прописана цена по стоимости
     if (isset($d['delivery_type'])) {
         $data['price_condition'] = 0;
         $data['delivery'] = $this->getDelivery($d['delivery_type'], $bsk->getSum());
     }
     //подсчитаем скидку
     $data['discount'] = 0;
     if ($discount = $this->getUser('discount')) {
         $bsk->discount = $data['discount'] = (double) $discount;
     }
     //подсчитаем бонусы
     $data['bonus'] = 0;
     //		if(empty($d['not_use_bonus']) && $bonus=$this->getUser('bonus')/10){
     //			if($bonus>$bsk->getSum()){
     //				$bonus=$bsk->getSum();
     //			}
     //
     //			$bsk->bonus=$data['bonus']=(float)$bonus;
     //		}
     if (!empty($d['use_bonus']) && ($bonus = $this->getUser('bonus') / 10)) {
         if ($bonus > $bsk->getSum()) {
             $bonus = $bsk->getSum();
         }
         $bsk->bonus = $data['bonus'] = (double) $bonus;
     }
     $bsk->delivery = $data['delivery'];
     $data['sum'] = $bsk->getSum();
     $data['count'] = $bsk->getCount();
     $data['total_sum'] = $bsk->getTotalSum();
     $data['sort'] = isset($d['sort']) ? $d['sort'] : '';
     $data['ord'] = isset($d['ord']) ? $d['ord'] : '';
     return $data;
 }
開發者ID:AlexanderWhi,項目名稱:tplshop2,代碼行數:82,代碼來源:Catalog.class.php


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