April 13th, 2017, 11:09 PM
Need help with integrating a cost calculator
I have built an installation cost calculator script. What it does is, it uses google's geocode API and calculates the distance between the Customer's address and Seller's address. And based on the distance, it calculates the installation charges.
Now this is working perfect. But the thing is, this calculator has some hidden default value which are different for all products.
So e.g. 3 products are listed on one page, I have to load 3 different calculator scripts.
What would be the best approach to implement this script?
April 13th, 2017, 11:13 PM
The only thing different between the products is the default value, right? So instead of loading different scripts, set a different default value.
If you want some more specific advice then you'll have to post code.
April 13th, 2017, 11:34 PM
Sorry I forgot to mention, the calculator loads in a dialog box when a button "Installation Calculator" button is clicked below each product box. So the calculator needs to be loaded client side. Which means on every click I have to change the default value if I have to follow your method?
April 14th, 2017, 12:08 AM
"Changing the default value" should only be a matter of setting a variable somewhere. That should be very easy to do.
How about posting that code?