function changeCurrency() { global $toC_Json, $osC_Database, $osC_Language, $osC_Tax, $osC_Weight, $osC_ShoppingCart, $osC_Currencies; $osC_Tax = new osC_Tax_Admin(); $osC_Weight = new osC_Weight(); $osC_Currencies = new osC_Currencies(); $currency = $_REQUEST['currency']; $currency_value = 1; foreach ($osC_Currencies->currencies as $key => $value) { if ($key == $currency) { $currency_value = $value['value']; break; } } if (osC_Order::updateCurrency($_REQUEST['orders_id'], $_REQUEST['currency'], $currency_value)) { $osC_ShoppingCart = new toC_ShoppingCart_Adapter($_REQUEST['orders_id']); $osC_ShoppingCart->_calculate(); $osC_ShoppingCart->updateOrderTotal(); $response = array('success' => true, 'feedback' => $osC_Language->get('ms_success_action_performed')); } else { $response = array('success' => false, 'feedback' => $osC_Language->get('ms_error_action_not_performed')); } echo $toC_Json->encode($response); }