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

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -