Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author pbosakov

    (@pbosakov)

    Yes, you can do any arithmetic operations with the calculated distance.

    For example, if your price is 3€ / km, you can use it in your formula.

    Price: [calculation total precision:2 "3 * fn_distance(start, finish, km)"]

    Thank you.

    Do I need any Google Maps subscription to do this?

    Plugin Author pbosakov

    (@pbosakov)

    You need a valid Google API key with access to the following services:

    • Maps JavaScript API
    • Distance Matrix API

    The service is free for low-volume usage. For more information, see https://developers.google.com/maps/documentation/javascript/get-api-key

    Hi, Thank you.

    It’s possible set this?
    in formula:

    1-5 km = 15€
    5-15 km = 25€
    15-35 km = 35€
    35-50 km = 45€

    Thank you

    Plugin Author pbosakov

    (@pbosakov)

    Yes, the Pro version lets you calculate the distance and then pass it to a custom PHP function to do more complex calculations (such as if/else conditional logic).

    Example:

    Starting address: [address start]
    Destination address: [address finish]
    Distance (km): [calculation distance precision:2 "fn_distance(start, finish, km)"]
    Price (€): [calculation price "fn_php(if ($_POST{'distance'} > 35) { return 45; } elseif($_POST{'distance'} > 15) { return 35; } elseif ($_POST{'distance'} > 5) { return 25; } else { return 15; })"]
    [calculate_button "Calculate"]

    Thanks

    This is the correct formula to do this?

    1-5 km = 15€
    5-15 km = 25€
    15-35 km = 35€
    35-50 km = 45€

    Starting address: [address start]
    Destination address: [address finish]
    Distance (km): [calculation distance precision:2 "fn_distance(start, finish, km)"]
    Price (€): [calculation price "fn_php(if ($_POST{'distance'} > 35) { return 45; } elseif($_POST{'distance'} > 15) { return 35; } elseif ($_POST{'distance'} > 5) { return 25; } else { return 15; })"]
    [calculate_button "Calculate"]
    Plugin Author pbosakov

    (@pbosakov)

    Yes, this code should work fine. If you plan to use the custom PHP code features provided by the plugin, I would recommend to make sure you have a developer who can understand and maintain the code to make sure everything is running and kept secure.

    Cheers,
    Petko

    Thank you

    Hi, need a developer to apply this formula in my website?

    or with an copy & paste work fine?

    Plugin Author pbosakov

    (@pbosakov)

    Copy/paste will work fine if you do not need to make any changes and if you do not run into any unexpected problems. I can provide support for the plugin itself, but I am not able to maintain or support the actual forms you create with it.

    Thanks 👍

    Hi,

    It’s possible restrict the address to a 50 km radius?

    e.g:

    Show only addresses in a50 km radius or distance 50 km <

    Thank you.

    Plugin Author pbosakov

    (@pbosakov)

    Hi

    Not technically possible at the moment, sorry 🙁

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Price per Km’ is closed to new replies.