I have a hook in the checkout process of magento, in the observer: checkout_controller_onepage_save_shipping_method. This observer action happens once a user chooses a shipping method in Magento then clicks the "next" button to save the shipping method and continue through the checkout process.
I have written code that may sometimes tell the user (depending on various factors such as shopping cart items and the state they are being shipped to) that he may not proceed with the checkout process and must call the store instead for special shipping instructions.
The regular redirect functions don't work inside onepage checkout because it is wrapped in an AJAX script, I have tried the following:
Mage::getSingleton('core/session')->addError('The shipping required for one of the products you are attempting to order..');
$response1 = $observer->getResponse();
$url = Mage::getUrl('checkout/cart');
$response1->setRedirect($url);
and
Mage::throwException($this->__('The shipping required for one of the products you are attempting to order requires special instructions, please call us.'));
$observer->getRequest()->setParam('return_url','http://www.google.com/');
exit;
and
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('checkout/cart'));
Mage::app()->getResponse()->sendResponse();
exit;
But none of these work. I believe I have to override some functions in OnePageController.php but I do not know what I need to update. Any help would be greatly appreciated. Thanks!