I am verifying shipping quotes during the event checkout_controller_onepage_save_shipping_method and if the verification fails i want to send the user back to shipping method selection but I would also like to display a message saying why it failed. Does Magento have a way of doing this built in?
I am already verifying the data I just lack the redirect to shipping methods and way to display a message.
Alan Storm’s answer is, as ever, informative and enlightening. But in this situation the onepage checkout is mostly AJAX which ignores the session error message, you won’t see it until leaving the checkout page.
In
saveShippingMethodActionthere is the following line:…and then $result is JSON encoded. If you override
Mage_Checkout_Model_Type_Onepage::saveShippingMethodto perform your check then control what is returned you can insert an error message that will be returned to the browser and shown to the user in a popup.Your override might look something like this: