I want to change the currency to USD for a quote depending on shipping method in Onepage checkout. The new currency should be reflected in the order review before going to the payment provider. A bonus would be if both currencies can be shown in the review, but only USD is also fine.
Nothing I do seem to have any effect, even though I recompile and empty the cache between . This is my current attempt:
app/code/local/Mage/Checkout/controllers/OnepageController.php
/**
* Save payment ajax action
*
* Sets either redirect or a JSON response
*/
public function savePaymentAction()
{
if ($this->_expireAjax()) {
return;
}
try {
if (!$this->getRequest()->isPost()) {
$this->_ajaxRedirectResponse();
return;
}
$data = $this->getRequest()->getPost('payment', array());
$result = $this->getOnepage()->savePayment($data);
if ($data['method'] == 'ourpaymentmethodofchoice') {
Mage::app()->getStore()->setCurrentCurrencyCode('USD');
}
// etc
I have also tried this:
$currency = Mage::getModel('directory/currency')->load('USD')
$quote = $this->getOnepage()->getQuote();
$quote->setForcedCurrency($currency);
$quote->save();
$this->getOnepage()->saveOrder();
We are running Magento 1.9.
What is the best way to change the currency programatically?
$quote->setBaseCurrencyCode($currencyCode); $quote->setQuoteCurrencyCode($currencyCode);
?local/
. That does not seem to be the case so it is still using the original core controller. I guess this question might be considered on hold in the meantime.$quote->setBaseCurrencyCode($currencyCode); $quote->setQuoteCurrencyCode($currencyCode);
did not make any difference.