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
Yii 1.1 or above jquery.js user module
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
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
$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
Be the first person to leave a comment
Please login to leave your comment.