/** * 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; }
/** * 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; }
/** * 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); }
/** * 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; }
/** * 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; }