haunter Posted January 30, 2013 Share Posted January 30, 2013 Hi. We need to set for one user CZK, for another EUR, but PS cannot remember user´s currency, only option is change core? Link to comment Share on other sites More sharing options...
El Patron Posted January 30, 2013 Share Posted January 30, 2013 Once the user set's their currency and as long as their cookie is good it will remember. You can't set a user's currency from the back office. Non-logged visitors without a cookie (first time or after cookie expires) will get shop default currency. You can set currency by country, then you can use the native Geo Location to detect their country (for non-logged). Link to comment Share on other sites More sharing options...
haunter Posted January 30, 2013 Author Share Posted January 30, 2013 (edited) Ok, little change in core file classes\controller\FrontController.php put this code before $currency = Tools::setCurrency($this->context->cookie); (around line 150) //if is customer logged in, we will change his currency. if($this->context->customer->logged && !$cookie->is_curr_changed){ $_POST['SubmitCurrency'] = 1; $_POST['id_currency'] = Db::getInstance()->getValue("SELECT currency FROM "._DB_PREFIX_."customer WHERE id_customer=".$this->context->customer->id.";", $use_cache = 0); $cookie->is_curr_changed = 1; } need update db too - we are importing this value, so you must change customer value manually by the phpMyAdmin ALTER TABLE YOUR_PREFIX_customer ADD COLUMN currency int(2) DEFAULT 1 Edited January 30, 2013 by haunter (see edit history) Link to comment Share on other sites More sharing options...
El Patron Posted January 30, 2013 Share Posted January 30, 2013 it's not clear why you have to change core for this, but if you are happy with it...sweet Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now