In the One Page Checkout the saveBilling step creates the Shipping Methods insert on the fly from the controller response (when
billing[use_for_shipping] is selected), which you can retrieve from an observer like so:
/* @var $response Mage_Core_Controller_Response_Http */ $response = $observer->getControllerAction()->getResponse(); $responseArray = Mage::helper('core')->jsonDecode($response->getBody());
However, the problem I've got is that the shipping value is a table rate based on the value of the shopping cart (e.g. free shipping on orders over £25) and there's a membership pricelist. This is all fine when someone logs into an account but it causes a problem with the guest checkout.
A field was added to the Billing section for customers to enter their membership number. When the saveBilling step is called the observer verifies the membership and recalculates the quote totals (
$quote->setTotalsCollectedFlag(false)->collectTotals();) ... this all works fine.
However it's possible that someone over the free shipping threshold drops below it when their pricelist is switched as some items are cheaper but the Shipping Methods insert has already been generated from the controller so the wrong shipping price is displayed.
I can work around it by removing prices from the template or manipulating the form - but those are both hacks. I'd like to be able to recreate the shipping methods response from the controller using the updated quote. Any ideas?