Ejemplo n.º 1
0
 /**
  * Performs final sum calculations and roundings.
  *
  * @return null
  *
  */
 protected function _calcTotalPrice()
 {
     // 1. add products price
     $dprice = $this->_oProductsPriceList->getBruttoSum();
     $this->_oPrice->setPrice($dprice);
     // 2. substract discounts
     if ($dprice) {
         // 2.1 applying basket item discounts
         foreach ($this->_aItemDiscounts as $oDiscount) {
             // skipping bundle discounts
             if ($oDiscount->sType == 'itm') {
                 continue;
             }
             $this->_oPrice->subtract($oDiscount->dDiscount);
         }
         // 2.2 applying basket discounts
         $this->_oPrice->subtract($this->_oTotalDiscount->getBruttoPrice());
         // 2.3 applying voucher discounts
         if ($oVoucherDisc = $this->getVoucherDiscount()) {
             $this->_oPrice->subtract($oVoucherDisc->getBruttoPrice());
         }
     }
     // 2.3 add delivery cost
     if (isset($this->_aCosts['oxdelivery'])) {
         $this->_oPrice->add($this->_aCosts['oxdelivery']->getBruttoPrice());
     }
     // 2.4 add wrapping price
     if (isset($this->_aCosts['oxwrapping'])) {
         $this->_oPrice->add($this->_aCosts['oxwrapping']->getBruttoPrice());
     }
     // 2.5 add payment price
     if (isset($this->_aCosts['oxpayment'])) {
         $this->_oPrice->add($this->_aCosts['oxpayment']->getBruttoPrice());
     }
     // 2.6 add TS protection price
     if (isset($this->_aCosts['oxtsprotection'])) {
         $this->_oPrice->add($this->_aCosts['oxtsprotection']->getBruttoPrice());
     }
 }