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