public function validateReviewForm(Customweb_Payment_ExternalCheckout_IContext $context, Customweb_Core_Http_IRequest $request) { if (!$context instanceof Customweb_SaferpayCw_Model_ExternalCheckoutContext) { throw new Customweb_Core_Exception_CastException('Customweb_SaferpayCw_Model_ExternalCheckoutContext'); } $this->redirectOnEmptyBasket(); $parameters = $request->getParameters(); $helper = Mage::helper('SaferpayCw'); $quote = $context->getQuote(); if ($context->hasBasketChanged($quote, $request)) { $context->updateFromQuote($quote); $context->save(); throw new Exception(Mage::helper('SaferpayCw')->__('The shopping cart has been altered!')); } if ($context->getShippingMethodName() == null) { throw new Exception($helper->__('Please select a shipping method before sending the order.')); } $requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds(); if ($requiredAgreements) { if (empty($parameters['agreement']) || !is_array($parameters['agreement'])) { $parameters['agreement'] = array(); } $postedAgreements = array_keys($parameters['agreement']); $diff = array_diff($requiredAgreements, $postedAgreements); if ($diff) { throw new Exception($helper->__('Please agree to all the terms and conditions before placing the order.')); } } }