/** * Convert amounts to store base currency * * @param array $amounts * @param Mage_Core_Model_Store $store * @return array */ protected function _convertPrices($amounts, $store) { $result = array(); if (is_array($amounts) && $amounts) { foreach ($amounts as $amount) { $value = $amount['value']; if ($amount['website_id'] == 0) { $rate = $store->getBaseCurrency()->getRate(Mage::app()->getBaseCurrencyCode()); if ($rate) { $value = $value / $rate; } else { continue; } } $result[] = $value; } } return $result; }
/** * @param float $price * @param Mage_Core_Model_Store $store * @return float */ public function convertToDefaultCurrency($price, Mage_Core_Model_Store $store) { if (!is_numeric($price)) { Mage::log(sprintf('price must be a numeric value in %s, got %s.', __CLASS__, $price), Zend_Log::WARN, Nosto_Tagging_Model_Base::LOG_FILE_NAME); $price = 0; } return Mage::helper('directory')->currencyConvert($price, $store->getBaseCurrency()->getCode(), $store->getDefaultCurrency()->getCode()); }