[Skip to main content](#vessel-content)

#   Use Geolocation plugin to select Country on user registration

##

- **[tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile")**
- [![tgowans1's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/37490-tgowans1 "View tgowans1's Profile") Topic Author
- [ Offline](/forum/user/37490-tgowans1)

Less More

- Posts: 16
- Thank you received: 2
-
-

7 years 11 months ago [\#300807](#300807) by [tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile")  *[Use Geolocation plugin to select Country on user registration](/forum/33-customers/896291-use-geolocation-plugin-to-select-country-on-user-registration#300807 "-- HikaShop version -- : 3.5.1 -- Joomla version -- : 3.9.0  Is it possible that the Custom Field, &quot;Country&quot; could be used to linked with the Geolocation plugin so that the user's Country could be automatically selected from the dropdown field? This would work in a similar way to how the Geolocation plugin works for automatically changing the displayed currency.")* was created by *[tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile")*

-- HikaShop version -- : 3.5.1
-- Joomla version -- : 3.9.0

Is it possible that the Custom Field, "Country" could be used to linked with the Geolocation plugin so that the user's Country could be automatically selected from the dropdown field? This would work in a similar way to how the Geolocation plugin works for automatically changing the displayed currency.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84OTYyOTEtdXNlLWdlb2xvY2F0aW9uLXBsdWdpbi10by1zZWxlY3QtY291bnRyeS1vbi11c2VyLXJlZ2lzdHJhdGlvbj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile")**
- [![tgowans1's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/37490-tgowans1 "View tgowans1's Profile") Topic Author
- [ Offline](/forum/user/37490-tgowans1)

Less More

- Posts: 16
- Thank you received: 2
-
-

7 years 11 months ago [\#300810](#300810) by [tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile")  Replied by *[tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile")* on topic *[Use Geolocation plugin to select Country on user registration](/forum/33-customers/896291-use-geolocation-plugin-to-select-country-on-user-registration#300810 "-- HikaShop version -- : 3.5.1 -- Joomla version -- : 3.9.0  Is it possible that the Custom Field, &quot;Country&quot; could be used to linked with the Geolocation plugin so that the user's Country could be automatically selected from the dropdown field? This would work in a similar way to how the Geolocation plugin works for automatically changing the displayed currency.")*

It appears that this feature already exists but is not working on my installation. It is failing on the below lines of code in the classes/field.php file (hikashopFieldDropdown class, display function)
Code:

if(isset($field-&gt;field_default) &amp;&amp; !$isValue) { if(array_key_exists($field-&gt;field_default, $field-&gt;field_value)){

!$isValue is returning 0
array_key_exists($field-&gt;field_default, $field-&gt;field_value) is also returning 0

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84OTYyOTEtdXNlLWdlb2xvY2F0aW9uLXBsdWdpbi10by1zZWxlY3QtY291bnRyeS1vbi11c2VyLXJlZ2lzdHJhdGlvbj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

7 years 11 months ago [\#300834](#300834) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Use Geolocation plugin to select Country on user registration](/forum/33-customers/896291-use-geolocation-plugin-to-select-country-on-user-registration#300834 "-- HikaShop version -- : 3.5.1 -- Joomla version -- : 3.9.0  Is it possible that the Custom Field, &quot;Country&quot; could be used to linked with the Geolocation plugin so that the user's Country could be automatically selected from the dropdown field? This would work in a similar way to how the Geolocation plugin works for automatically changing the displayed currency.")*

Hello,

It would indicate that your country field default value is not set-up.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84OTYyOTEtdXNlLWdlb2xvY2F0aW9uLXBsdWdpbi10by1zZWxlY3QtY291bnRyeS1vbi11c2VyLXJlZ2lzdHJhdGlvbj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile")**
- [![tgowans1's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/37490-tgowans1 "View tgowans1's Profile") Topic Author
- [ Offline](/forum/user/37490-tgowans1)

Less More

- Posts: 16
- Thank you received: 2
-
-

7 years 11 months ago -  7 years 11 months ago [\#300837](#300837) by [tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile")  Replied by *[tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile")* on topic *[Use Geolocation plugin to select Country on user registration](/forum/33-customers/896291-use-geolocation-plugin-to-select-country-on-user-registration#300837 "-- HikaShop version -- : 3.5.1 -- Joomla version -- : 3.9.0  Is it possible that the Custom Field, &quot;Country&quot; could be used to linked with the Geolocation plugin so that the user's Country could be automatically selected from the dropdown field? This would work in a similar way to how the Geolocation plugin works for automatically changing the displayed currency.")*

Hi Jerome,

Default value for country has been set in the address_country custom field. I have also tried setting the default value to other countries with no success.
This message contains confidential information

Last edit: 7 years 11 months ago by [tgowans1](/forum/user/37490-tgowans1 "View tgowans1's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84OTYyOTEtdXNlLWdlb2xvY2F0aW9uLXBsdWdpbi10by1zZWxlY3QtY291bnRyeS1vbi11c2VyLXJlZ2lzdHJhdGlvbj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[Jerome](/forum/user/80-jerome "View Jerome's Profile")**
- [![Jerome's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar80.png)](/forum/user/80-jerome "View Jerome's Profile")
- [ Offline](/forum/user/80-jerome)
- HikaShop core developer

Less More

- Posts: 26394
- Thank you received: 4078
-
- [](http://obsi.dev)
-

7 years 11 months ago [\#300845](#300845) by [Jerome](/forum/user/80-jerome "View Jerome's Profile")  Replied by *[Jerome](/forum/user/80-jerome "View Jerome's Profile")* on topic *[Use Geolocation plugin to select Country on user registration](/forum/33-customers/896291-use-geolocation-plugin-to-select-country-on-user-registration#300845 "-- HikaShop version -- : 3.5.1 -- Joomla version -- : 3.9.0  Is it possible that the Custom Field, &quot;Country&quot; could be used to linked with the Geolocation plugin so that the user's Country could be automatically selected from the dropdown field? This would work in a similar way to how the Geolocation plugin works for automatically changing the displayed currency.")*

Hello,

I cannot reproduced your issue.
If the geolocation plugin do store the "geoloc_zone_id" in the user session, that value is used by the Zone field and it replace the default country that you have stored in the field.

I don't know what zone is retrieved by your plugin (and stored in the session) but there is no kind of bug in the HikaShop field system.

Regards,

---

Jerome - Obsidev.com
HikaMarket &amp; HikaSerial developer / HikaShop core dev team.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMzLWN1c3RvbWVycy84OTYyOTEtdXNlLWdlb2xvY2F0aW9uLXBsdWdpbi10by1zZWxlY3QtY291bnRyeS1vbi11c2VyLXJlZ2lzdHJhdGlvbj90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop- Install &amp; Update- Product &amp; Category Display- Content Creation- Sales and Orders- - Orders management- - Reports &amp; Statistics- Customers- Checkout- Payment Methods- Shipping Methods- Import &amp; Export (CSV, XLS…)- Specific Features- - Affilation- - Taxes- - Wishlist- - Vote- - Carousel &amp; Slider- - Mass Actions- - Filters &amp; Search- - Discount &amp; Coupon- - Feature Request- Integrations- Showcase- General Talk about HikaShop- Development- - HikaShop 3.0 Beta- Translation- Commercial Jobs HikaShop Components- HikaMarket- - Market: Feature requests- - Market: How to?- - Market: Bug Report- HikaSerial- - General talk about HikaSerial- - Serial: Bug Report- - Serial: How to?- - Support en Français de HikaSerial (French Support)- - HikaSubscription- HikaAuction- - Auction: Feature requests- - Auction: How to?- - Auction: Bug report Hikashop around the world- Support en Français (French Support)- Russian- - FAQ. Курс выживания с Hikashop. Частые вопросы и о- - Расширения Hikashop- - Наши сайты на Hikashop- 日本語版サポート(Japanese Support)- Thai- German Archives- Bug Report- How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.204 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)

[](#top)
