• Welcome to KonaKart Community Forum. Please login or sign up.
 

How to Refresh Shipping Quotes in One Page Checkout after Address Change

Started by kevix, March 06, 2013, 11:38:48 am

Previous topic - Next topic

kevix

I have written a set of shipping modules with availability depending on the address (currently just country but I also plan one to depend on postcodes). The behaviour that I expected to see was that if the customer changed the address the Shipping Quotes would be regenerated, a new one selected if necessary, and the possible quotes displayed in the pull down on the one page checkout. But, out of the box 6.5.0.0 doesn't do this. The methods on the pulldown and the shipping cost in the totals are still for the original address.

I have customised CheckoutAction so that if the address changes it will recreate the quotes and select an appropriate one (either the original, if still valid) or the first of the new set of quotes, and I can see this change is passed on and used in the totals.

How, in CheckoutAction, can I send the new array of quotes to the OnePageCheckout so that they are displayed in the Shipping pulldown menu?


kevix

So some kind of client refresh is needed here. I spent some time looking through the GWT one page checkout before I realised that it is not used in 6.5.1.0.

The answer is to modify CheckoutOnePageRefreshAction.java so that on an address change it regenerates the shipping quotes and creates an array of shipping quote codes and an array of names. Getters are then provided for the two arrays.

On the checkout side in CatalogCheckoutOnePageBody.jsp, in the onePageRefreshCallback check the result for the arrays and if found process them into the option tags, then use jquery to insert the tags into the shippingQuotes element (the list), and finally call refreshShipping() which will update the totals with the new default shipping.

Exactly the same can be done for payments, if you want to limit them to certain countries (we only want cheques from a UK billing address).