Пример #1
0
 /**
  * Returns oxprice object for wrapping
  *
  * @param int $dAmount article amount
  *
  * @return object
  */
 public function getWrappingPrice($dAmount = 1)
 {
     if ($this->_oPrice === null) {
         $this->_oPrice = oxNew('oxprice');
         if (!$this->_blWrappingVatOnTop) {
             $this->_oPrice->setBruttoPriceMode();
         } else {
             $this->_oPrice->setNettoPriceMode();
         }
         $oCur = $this->getConfig()->getActShopCurrencyObject();
         $this->_oPrice->setPrice($this->oxwrapping__oxprice->value * $oCur->rate, $this->_dVat);
         $this->_oPrice->multiply($dAmount);
     }
     return $this->_oPrice;
 }
Пример #2
0
 /**
  * Returns oxprice object for delivery costs
  *
  * @param double $dVat delivery vat
  *
  * @return oxPrice
  */
 public function getDeliveryPrice($dVat = null)
 {
     if ($this->_oPrice === null) {
         // loading oxprice object for final price calculation
         $this->_oPrice = oxNew('oxPrice');
         if (!$this->_blDelVatOnTop) {
             $this->_oPrice->setBruttoPriceMode();
         } else {
             $this->_oPrice->setNettoPriceMode();
         }
         $this->_oPrice->setVat($dVat);
         // if article is free shipping, price for delivery will be not calculated
         if ($this->_blFreeShipping) {
             return $this->_oPrice;
         }
         // calculating base price value
         switch ($this->oxdelivery__oxaddsumtype->value) {
             case 'abs':
                 $dAmount = 0;
                 if ($this->oxdelivery__oxfixed->value == 0) {
                     // 1. Once per Cart
                     $dAmount = 1;
                 } elseif ($this->oxdelivery__oxfixed->value == 1) {
                     // 2. Once per Product overall
                     $dAmount = $this->_iProdCnt;
                 } elseif ($this->oxdelivery__oxfixed->value == 2) {
                     // 3. Once per Product in Cart
                     $dAmount = $this->_iItemCnt;
                 }
                 $oCur = $this->getConfig()->getActShopCurrencyObject();
                 $this->_oPrice->add($this->oxdelivery__oxaddsum->value * $oCur->rate);
                 $this->_oPrice->multiply($dAmount);
                 break;
             case '%':
                 $this->_oPrice->add($this->_dPrice / 100 * $this->oxdelivery__oxaddsum->value);
                 break;
         }
     }
     // calculating total price
     return $this->_oPrice;
 }