• Resolved nikolinaklobucar1

    (@nikolinaklobucar1)


    Is it possible to add some plugin that will recognize which country the user comes from and that will place a flag in front of the phone number field automatically?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author e4jvikwp

    (@e4jvikwp)

    Hi,

    Thanks for your message. This is something we will have to report to our programmers for the future releases, but for the moment this is not a feature you could implement by registering to some particular hooks, I’m sorry. An override of that specific View (page) would be necessary in this case.

    However, the feature you requested is not so easy to be implemented, because the result may not be accurate. The most accurate way, yet not 100% accurate, to implement this feature would be by using an external API system that would map the IP address to a country after performing an HTTP request. This is not so convenient, because a third party system for validating the IP addresses would be required.
    The only other existing solutions would be based on JavaScript, where the country should be guessed from the browser’s locale (this cannot be very accurate because I could be based in Italy and have my browser in English, and mapping the language locale to a country may not always be possible), or the systems should rely on the browser’s native “Navigator geolocation API”. The bad thing about this technique is that your browser needs to ask the user the permission to access their location, and of course if this was declined, nothing would work.

    At the moment you can suggest a list of “preferred” countries at the top of the list, and this is probably an efficient way of choosing the proper country.

    In any case, we are going to share with our programmers your feature request.

    Thank you,
    The VikWP Team

    Thread Starter nikolinaklobucar1

    (@nikolinaklobucar1)

    Hello,
    where I can find a list of countries in the code? Where I can change that?

    Plugin Author e4jvikwp

    (@e4jvikwp)

    Hello,

    Countries are not statically read from the code, they are actually stored in an apposite database table of Vik Rent Car (vikrentcar_countries), and they support translations (through the built-in Translations function of our plugin).

    Not sure what you would like to change for the countries, but they contain ISO 3166 compliant codes.

    Thread Starter nikolinaklobucar1

    (@nikolinaklobucar1)

    You told me in the answer:

    At the moment you can suggest a list of “preferred” countries at the top of the list, and this is probably an efficient way of choosing the proper country.

    How to do that?

    Plugin Author e4jvikwp

    (@e4jvikwp)

    Oh okay, sorry I thought you were referring to the list of countries displayed in the last step of the booking process (the custom field of type “Country”).

    The so called “Preferred Countries” are used to render the custom field of type “Phone Number”, and they simply serve to activate the proper formatting of the phone number of a specific country, with the apposite country prefix.

    From the first tab of the Configuration page, Search Parameters section, you will find the apposite setting “Preferred Countries Ordering” to define a list of countries to be placed on top of the list, and those should represent the most common countries from which your clients come from.
    This feature only serves as a way to make sure to always collect valid and complete phone numbers from foreign countries. Our system is based on the official Phone library from Google.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Geolocation’ is closed to new replies.