#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2010
    Location
    Gujarat, India
    Posts
    14
    Rep Power
    0

    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?
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,394
    Rep Power
    9645
    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.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2010
    Location
    Gujarat, India
    Posts
    14
    Rep Power
    0
    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?
  6. #4
  7. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,394
    Rep Power
    9645
    "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?

IMN logo majestic logo threadwatch logo seochat tools logo