本文整理汇总了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;
}