php - How do you set the default currency programmatically in opencart? -
php - How do you set the default currency programmatically in opencart? -
i know how country user accessing site based on ip address. want set currency automatically based on ip address. or module in opencart should change?
according source code in system/library/currency.php
can call:
$this->currency->set('gbp');
anywhere in controller. called whenever user changes currency clicking on currency sign in header - can check in catalog/controller/module/currency.php
:
if (isset($this->request->post['currency_code'])) { $this->currency->set($this->request->post['currency_code']); // ... }
unfortunately there no check whether trying set existing (defined, registered) currency code or not create sure using codes nowadays in db (i.e. created via administration).
php opencart
Comments
Post a Comment