Exemple #1
0
 private function initializeCurrency()
 {
     /** @var $currencyHelper Ess_M2ePro_Model_Currency */
     $currencyHelper = Mage::getSingleton('M2ePro/Currency');
     if ($currencyHelper->isConvertible($this->proxyOrder->getCurrency(), $this->quote->getStore())) {
         $currentCurrency = Mage::getModel('directory/currency')->load($this->proxyOrder->getCurrency());
     } else {
         $currentCurrency = $this->quote->getStore()->getBaseCurrency();
     }
     $this->quote->getStore()->setData('current_currency', $currentCurrency);
 }
Exemple #2
0
 /**
  * Calculate shipping price according to store config, account settings, currency rate
  *
  * @param $shippingPrice
  * @return float
  */
 private function calculateShippingPrice($shippingPrice)
 {
     /** @var $taxCalculator Mage_Tax_Model_Calculation */
     $taxCalculator = Mage::getSingleton('tax/calculation');
     if ($this->needToAddShippingTax()) {
         $taxAmount = $taxCalculator->calcTaxAmount($shippingPrice, $this->proxyOrder->getTaxRate(), false, false);
         $shippingPrice += $taxAmount;
     } elseif ($this->needToSubtractShippingTax()) {
         $taxAmount = $taxCalculator->calcTaxAmount($shippingPrice, $this->proxyOrder->getTaxRate(), true, false);
         $shippingPrice -= $taxAmount;
     }
     $shippingPrice = Mage::getSingleton('M2ePro/Currency')->convertPrice($shippingPrice, $this->proxyOrder->getCurrency(), $this->quote->getStore());
     return round($shippingPrice, 2);
 }