コード例 #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');
         $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;
 }
コード例 #3
0
 /**
  * Applies discount for current price
  *
  * @param oxprice $oPrice  basket item price object
  * @param double  $dAmount basket item amount (default 1)
  *
  * @return null
  */
 public function applyDiscount($oPrice, $dAmount = 1)
 {
     if ($this->oxdiscount__oxaddsumtype->value == 'abs') {
         $oCur = $this->getConfig()->getActShopCurrencyObject();
         $oDiscountPrice = oxNew('oxprice');
         $oDiscountPrice->setBruttoPriceMode();
         $oDiscountPrice->setPrice($this->oxdiscount__oxaddsum->value * $oCur->rate, $oPrice->getVat());
     } else {
         //percent discount
         $oDiscountPrice = oxNew('oxprice');
         $oDiscountPrice->setBruttoPriceMode();
         $oDiscountPrice->setPrice($oPrice->getBruttoPrice() / 100 * $this->oxdiscount__oxaddsum->value, $oPrice->getVat());
     }
     $oDiscountPrice->multiply($dAmount * -1);
     $oPrice->addPrice($oDiscountPrice);
     if ($oPrice->getBruttoPrice() < 0 || $oPrice->getNettoPrice() < 0) {
         $oPrice->setPrice(0);
     }
 }
コード例 #4
0
 /**
  * Sets total discount value
  *
  * @param double $dDiscount new total discount value
  *
  * @return null
  */
 public function setTotalDiscount($dDiscount)
 {
     $this->_oTotalDiscount = oxNew('oxPrice');
     $this->_oTotalDiscount->setBruttoPriceMode();
     $this->_oTotalDiscount->add($dDiscount);
 }
コード例 #5
0
ファイル: oxarticle.php プロジェクト: Crease29/oxideshop_ce
 /**
  * Applies discounts which should be applied in general case (for 0 amount)
  *
  * @param oxprice $oPrice Price object
  */
 public function applyDiscountsForVariant($oPrice)
 {
     // apply discounts
     if (!$this->skipDiscounts()) {
         $oDiscountList = oxRegistry::get("oxDiscountList");
         $aDiscounts = $oDiscountList->getArticleDiscounts($this, $this->getArticleUser());
         reset($aDiscounts);
         foreach ($aDiscounts as $oDiscount) {
             $oPrice->setDiscount($oDiscount->getAddSum(), $oDiscount->getAddSumType());
         }
         $oPrice->calculateDiscount();
     }
 }
コード例 #6
0
ファイル: Order.php プロジェクト: Alpha-Sys/oxideshop_ce
 /**
  * Returns order payment expenses price object
  *
  * @return oxprice
  */
 public function getOrderPaymentPrice()
 {
     if ($this->_oPaymentPrice != null) {
         return $this->_oPaymentPrice;
     }
     $this->_oPaymentPrice = oxNew('oxprice');
     $this->_oPaymentPrice->setBruttoPriceMode();
     $this->_oPaymentPrice->setPrice($this->oxorder__oxpaycost->value, $this->oxorder__oxpayvat->value);
     return $this->_oPaymentPrice;
 }
コード例 #7
0
ファイル: oxorder.php プロジェクト: mibexx/oxid_yttutorials
 /**
  * Returns order TS protection price object
  *
  * @return oxprice
  */
 public function getOrderTsProtectionPrice()
 {
     if ($this->_oTsProtectionPrice != null) {
         return $this->_oTsProtectionPrice;
     }
     $this->_oTsProtectionPrice = oxNew('oxprice');
     $this->_oTsProtectionPrice->setBruttoPriceMode();
     $this->_oTsProtectionPrice->setPrice($this->oxorder__oxtsprotectcosts->value, $this->getConfig()->getConfigParam('dDefaultVAT'));
     return $this->_oTsProtectionPrice;
 }