2

I am sending my magento store data to mobile application through soap request. I am having issue with multi currency. To mange the multi currency in android manging conversion through javascript.

My store support GBP , USD and Euro. Base currency is USD. Now when i switch currency to GBP in mobile it will convert the price correctly and send response to magento with my currency code and quote id for cart.

in request i am getting Quote Id and Currency code.

How can i set the GBP instead of the USD in quote?

i did try to set the currency using following code BUT it gets overwritten to USD not processing with GBP.

   $code=isset($_REQUEST['code'])?$_REQUEST['code']:'GBP';  

   $write_connection = Mage::getSingleton('core/resource')->getConnection('core_write'); 

   $fields_arr = array();

   $fields_arr['quote_currency_code'] = $code;     

   $where = $write_connection ->quoteInto('entity_id =?', $shoppingcartid); 
  $write_connection->update('sales_flat_quote', $fields_arr, $where);

Above code will set quote_currency_code currency in db for that quote id.

Need help to set the currency for quote programmatically.

1 Answer 1

1

You should use quote Model

$quote = Mage::getModel('sales/quote')->load($shoppingcartid);

Then Set Currency

$quote->setCurrency('GBP');
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.