Exemple #1
0
 function setKlarnaCartPrices(VirtueMartCart $cart, &$cart_prices, $method)
 {
     $this->_getCartAddressCountryCode(NULL, $country, $countryId);
     $invoice_fee = KlarnaHandler::getInvoiceFee($method, $country);
     $invoice_tax_id = KlarnaHandler::getInvoiceTaxId($method, $country);
     $_psType = ucfirst($this->_psType);
     $cart_prices[$this->_psType . 'Value'] = $invoice_fee;
     $taxrules = array();
     if (!empty($invoice_tax_id)) {
         $db = JFactory::getDBO();
         $q = 'SELECT * FROM #__virtuemart_calcs WHERE `virtuemart_calc_id`="' . $invoice_tax_id . '" ';
         $db->setQuery($q);
         $taxrules = $db->loadAssocList();
     }
     if (!class_exists('calculationHelper')) {
         require JPATH_VM_ADMINISTRATOR . DS . 'helpers' . DS . 'calculationh.php';
     }
     $calculator = calculationHelper::getInstance();
     if (count($taxrules) > 0) {
         $cart_prices['salesPrice' . $_psType] = $calculator->roundInternal($calculator->executeCalculation($taxrules, $cart_prices[$this->_psType . 'Value']));
         $cart_prices[$this->_psType . 'Tax'] = $calculator->roundInternal($cart_prices['salesPrice' . $_psType]) - $cart_prices[$this->_psType . 'Value'];
     } else {
         $cart_prices['salesPrice' . $_psType] = $invoice_fee;
         $cart_prices[$this->_psType . 'Tax'] = 0;
     }
 }