This is a simple currency management module having: list of all currencies get/update, converter, geoip based currency code getter/setter, currency drop down widget
Requirements ¶
Yii 1.1 or above jquery.js user module
Installation ¶
Unzip
Copy the webin folder to protected/modules/
add
'application.modules.currencymanager.models.*',into config/main.php -> 'import'=>array()
under config/main/
'modules'=>array( 'currencymanager', ),import tbl_currency.sql to your database
You are ready to go
FEATURES ¶
- List of all currencies around the world
- Update all or selected curriencies using google currency converter (requires admin login)
- Widget for currency dropdown select box (Choosen enabled).
- Currency converter with respect to USD
- Set default currency in yii session as your desired currency code or get currency code based on user's geographical location
Usage ¶
To display active and nonzero currency fields as DropDown , simply call "currencymanager.widgets.GetCurrencyDropdown" //it sets Yii::app()->session['currency'] to the desired currency thru ajax post // no furthur coding required //set reloadgrid as true (optional) if you have some gird to reload after changing the currency //or change the view file "_select" of this widget under widgets/views
<?php
$this->widget('currencymanager.widgets.GetCurrencyDropdown'
//,array(
//'reloadgrid'=>true //Default False
//,'filterzeros'=>false //Default true
//)
)
?>
To change $(USD) currency to XXX currency simply call
Yii::app()->getModule('currencymanager')->convertcurrency($to,$price);
$to : (string) to the desired currency format eg: to change to european: "EUR" $price : (numerical) the desired price to be converted
To set the default currency to XXX simply call
Yii::app()->getModule('currencymanager')->setdefaultcurrency($currency_code);
it saves the currency code to yii session. to retrive this value simply call :
Yii::app()->session['currency']
Note: $currencycode is optional. If it not set, it will find the user's ip and the geolocation and hence the currency code
User Contributed Notes 1
Is the update to the database table manual?
isn't there a regular check performed automatically on the tbl_currency?
Leave a comment
If you have any questions, please ask in the forum instead.
Join the conversation to share a note.