• Resolved momoments

    (@momoments)


    i need help please. I’m looking for a way that customers on my website have the opportunity to calculate their travel expenses themselves. I have already implemented that they can find the distance from my start to the location with a link on google maps. If you now know how big the distance is, you should enter this number of kilometers in a field, which always multiplies this number by € 0.80. Is that possible with this plugin? How do I go about please?

    Or can I handle it even more easily with the possibility of the DISTANCE MODULE?
    I’m looking for a way that my bridal couples can calculate on my website equal to the travel costs. If you complete the contact form there and enter the location of the event, google map calculates the travel costs based on the registered mileage allowance of € 0.80. Can you help me if it is possible with the help of a plugin?

    Greetings from Germany MO

    • This topic was modified 6 years, 11 months ago by momoments.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @momoments,

    Yes, that’s possible and very simple, but you will need the Developer or Platinum versions of the plugin, that include the “DISTANCE” module.

    I’ll try to describe the process with an example:

    – Assuming there are two addresses fields in the form: fieldname1 and fieldname2, and you want get the distance between them in kilometers, and multiply the result by 0.8

    You only should insert a calculated field in the form with the following equation:

    
    DISTANCE(fieldname1, fieldname2, 'km', 'DRIVING')*0.8
    

    As the form will use the Google APIs to get the distance, you will need a Google API Key to use them from your website’s domain. The API Keys are generated for free from the Google Developer Console (https://console.developers.google.com/)

    With the API Key you should enabling the following APIs:

    – Google Maps JavaScript API
    – Google Maps Geocoding API
    – Google Maps Distance Matrix API

    Finally, after generate the API Key you should pass it to the form, it is as simple as include a new attribute in the form’s shortcode. Assuming it is the form with id=”1″, the shortcode would be:

    
     [CP_CALCULATED_FIELDS id="1" google_api_key="<your key>"]
    

    Note: replace the text <your key> with the Key generated in the Google Console.

    Best regards.

    Thread Starter momoments

    (@momoments)

    Thank you very much ??

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