- Posts: 35
- Thank you received: 1
Force currency based on country ?
I'm looking to build a shop with Hikashop, perhaps the business version. I looked into the geolocation plugin and it looks interesting. Basically, I need:
1- Specific prices by currency
2- Force the currency based on users location. This could be done with either the geolocation plugin from what I can see but a simple Country selection box would suffice - In that case, I guess I would have to create my own module?
So my question is, in either case, will I be able to force the country upon checkout to the one determined in 2 above? And not give the user the possibility to change it...
Thanks!
Please Log in or Create an account to join the conversation.
In HikaShop, you can set different prices by currency.
And you can force a currency based on the user location, you need the plugin geolocation. It will select automatically the currency and the user couldn't find it, or as you said, you can create your own module to select a country and then force the currency.
ps: the documentation for the geolocation plugin (I think you already read this)
www.hikashop.com/en/support/documentatio...hop-geolocation.html
Please Log in or Create an account to join the conversation.
Thanks for the reply, yes I read that. My question was: Will the user be able to change his country when entering his address upon checkout?
Thanks
Please Log in or Create an account to join the conversation.
In fact, that's two different things.
When the geoloc plugin sets the zone of the user it's his default zone.
Once the user enters his address, the zone of the user will be based on his address.
However, the current currency won't change if the user has an address with a zone different from his geoloced zone.
Please Log in or Create an account to join the conversation.
Thanks!
Please Log in or Create an account to join the conversation.
Make sure that your use the zone namekeys as in the hikashop_zone table of the database for your countries.
When you get the selection, you need to set the currency like that:
$app=&JFactory::getApplication();
$app->setUserState( 'com_hikashop.currency_id',$currency_id);
And store the country selected in the session.
Then, in the file "custom_fields" of the view "user" you will have to add something like that:
$this->address->address_country = $_SESSION;
in order to set the default country value and then add a line CSS to hide the field on the address form.
You will have to do something similar in the "form" file of the view "address" for when the user is editing an address.
Please Log in or Create an account to join the conversation.
Would I have to apply these modifications to the hikashop core or can I make template overrides? Could I also use the setUserState to set the country?
Regards
Please Log in or Create an account to join the conversation.
If you do your modifications via the Display->Views as I explained, it will generate overrides automatically.
Please Log in or Create an account to join the conversation.
Where can I find the code for the guest address form at checkout (address and login step)? I'm trying to find the view for that and replace the line that outputs a select box for the country by the fixed country value in simple text.
Thanks
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
- a module to switch the country, loaded with the hikashop country zones and defaults to the geolocated country
- the module switches currency and sets the zone once a country is selected
- the custom_fields override takes the zone info, translates that into a country zone_namekey and sets the address country. Then it simply outputs the country with a flag alongside the state selection.
Still have some adjustments here and there but I think it's pretty much solved. Thanks
Please Log in or Create an account to join the conversation.
Indeed overrides are the way to go !
Please Log in or Create an account to join the conversation.