logic question regarding shipping calculation
Hey quick question regarding the same sake of the Question Topic (above).
I plan to have the following structure
Basket - This will include basket summary and form to enter a coupon code.
Checkout - This will just include a form for billing/shipping details and card payment details
Confirm - this does all the paypal communication stuff
Success - This page will display thank you message and include server behaviors for email and adding order to database.
For shipping calculation I plan to place all the calculation in a separate hidden php file. I assume the best way to accomplish this, is on the checkout page when a customer enters the postcode for shipping, it will access the separate hidden php file and then return the calculated shipping cost as a session variable. I assume I would either do some kind of AJAX call to this file, or some type of inline javascript on the form field in question (kind of like an onclick event - but obviously when a customer clicks out of the input field?
The alternative option is to place the shipping postcode form field on the basket page. But then obviously with this method the customer could easily type in any old postcode on the basket page which can be different to the postcode they enter on the checkout page (I could prevent this by storing the post code as a session and then adding this postcode session variable on the checkout page and making the postcode form input read only.
Which would be the best method from described above? or is there an alternative that I haven't thought of?
NOTE: the postcode calculation will take only the first 2 characters of the customers delivery postcode, since the shipping companies use the first 2 characters of the postcode to associate with a shipping zone.
Chris