当前位置: 首页>>代码示例>>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;未经允许,请勿转载。