Exemplo n.º 1
0
 /**
  * Returns price of TS protection product
  *
  * @return float
  */
 public function getPrice()
 {
     if ($this->_oPrice == null) {
         if ($sTsId = $this->getTsId()) {
             $aTsProducts = $this->getAllTsProducts();
             if ($aTsProducts[$sTsId] && is_array($aTsProducts[$sTsId])) {
                 $oConfig = $this->getConfig();
                 $dVat = $oConfig->getConfigParam('dDefaultVAT');
                 $dPrice = oxPrice::netto2Brutto($aTsProducts[$sTsId]['netto'], $dVat);
                 $oPrice = oxNew('oxPrice');
                 $oPrice->setPrice($dPrice);
                 if ($oConfig->getConfigParam('blCalcVATForPayCharge')) {
                     $oPrice->setVat($dVat);
                 }
                 $this->_oPrice = $oPrice;
             }
         }
     }
     return $this->_oPrice;
 }
Exemplo n.º 2
0
 /**
  * Depending on view mode prepare price before calculation
  *
  * @param double $dPrice                 - price
  * @param double $dVat                   - VAT
  * @param bool   $blCalculationModeNetto - if calculation mode netto - true
  *
  * @return double
  */
 protected function _preparePrice($dPrice, $dVat, $blCalculationModeNetto = null)
 {
     if ($blCalculationModeNetto === null) {
         $blCalculationModeNetto = $this->_isPriceViewModeNetto();
     }
     $oCurrency = $this->getConfig()->getActShopCurrencyObject();
     $blEnterNetPrice = $this->getConfig()->getConfigParam('blEnterNetPrice');
     if ($blCalculationModeNetto && !$blEnterNetPrice) {
         $dPrice = round(oxPrice::brutto2Netto($dPrice, $dVat), $oCurrency->decimal);
     } elseif (!$blCalculationModeNetto && $blEnterNetPrice) {
         $dPrice = round(oxPrice::netto2Brutto($dPrice, $dVat), $oCurrency->decimal);
     }
     return $dPrice;
 }