activa Posted October 8, 2015 Report Share Posted October 8, 2015 i have a code that i can convert a currency to another currency , now i want to get the exchange rate $amount = $this->Currencies->convert($amount, $from_currency, $to_currency, $company_id) ; now i want to get the exchange rate for this conversion ? is possible from the model it self ? Quote Link to comment Share on other sites More sharing options...
Cody Posted October 8, 2015 Report Share Posted October 8, 2015 You want Currencies::get() Note that the exchange_rate is based off of your default currency. So if you want the rate of conversion between two currencies and neither is the default currency, you'll need to pull all 3 currencies and calculate the difference. Quote Link to comment Share on other sites More sharing options...
Blesta Addons Posted October 9, 2015 Report Share Posted October 9, 2015 You can do it like that $amount = $this->Currencies->convert($original_amount, $from_currency, $to_currency, $company_id) ; $exchange_rate = ($amount/$original_amount) ; activa 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.