Jump to content

Recommended Posts

I need some help with a problem I am facing....

 

I have a $Shipping array which is made up of method, and price. Using smarty {Section} I fill a drop down box with a $Shipping array.

 

This all exists on my order systems confirmation page, so the system has already calculated (Cost Of Goods, Tax). The problem I am facing is that the variable $Total is dependent on which Shipping Method the user chooses from the dropdown.

 

I need a way using smarty to dynamically update the $Total and {Total} so that the user can see what his new total comes to when he changes shipping options.

 

Also based on this array when the user confirms his order at that page and enters his credit card I need to php to see which option was selected and make sure the $Total variable is updated so the amount can be sent to the merchant.

 

I was thinking the ideal way to do this was by using AJAX so that each time the user changes the shipping method the $Total Variable is updated. This way the page would be updated dynamically and when the user clicks Finalize Order the $Total is already correct. This way i dont need to get the results from the dropdown box and then add it to $Total on the finalize.php script?

 

I hope I didnt confuse anyone..

 

If anyone can provide assistance in how I would go about developing this in PHP and AJAX, or a better way of going about this.

 

Thanks for your time,

 

-Evan

Link to comment
https://forums.phpfreaks.com/topic/53773-help-with-a-solution/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.