|
Hello !
I’m working on multishipping part and get some problems on “place order” button redirection. The redirection works with the onepage process, but I’ll use the multishipping process in all cases.
I need help to understand the difference between onepage and multishipping method called when you click on orange “place order” button.
/app/code/core/Mage/Checkout/controllers/OnepageController.php
public function saveOrderAction() { $this->_expireAjax();
try { if ($data = $this->getRequest()->getPost('payment', false)) { $this->getOnepage()->getQuote()->getPayment()->importData($data); } $this->getOnepage()->saveOrder(); $redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl(); $result['success'] = true; $result['error'] = false; } catch (Mage_Core_Exception $e) { Mage::logException($e); $result['success'] = false; $result['error'] = true; $result['error_messages'] = $e->getMessage(); } catch (Exception $e) { Mage::logException($e); $result['success'] = false; $result['error'] = true; $result['error_messages'] = $this->__('There was an error processing your order. Please contact us or try agian later.'); }
/** * when there is redirect to third party, we don't want to save order yet. * we will save the order in return action. */ if (isset($redirectUrl)) { $result['redirect'] = $redirectUrl; }
$this->getResponse()->setBody(Zend_Json::encode($result)); }
/app/code/core/Mage/Checkout/controllers/MultishippingController.php
public function overviewPostAction() { try { //$payment = $this->getRequest()->getPost('payment'); $paymentInstance = $this->_getCheckout()->getQuote()->getPayment();
if (isset($payment['cc_number'])) { $paymentInstance->setCcNumber($payment['cc_number']); } if (isset($payment['cc_cid'])) { $paymentInstance->setCcCid($payment['cc_cid']); } $this->_getCheckout()->createOrders(); $this->_getState()->setActiveStep( Mage_Checkout_Model_Type_Multishipping_State::STEP_SUCCESS ); $this->_getCheckout()->getCheckoutSession()->clear(); $this->_getCheckout()->getCheckoutSession()->setDisplaySuccess(true); $this->_redirect('*/*/success'); } catch (Mage_Core_Exception $e){ Mage::getSingleton('checkout/session')->addError($e->getMessage()); $this->_redirect('*/*/billing'); } catch (Exception $e){ Mage::getSingleton('checkout/session')->addError('Order place error.'); $this->_redirect('*/*/billing'); } }
On “onepage” process
$redirectUrl = $this->getOnepage()->getCheckout()->getRedirectUrl();
redirection is ok to the payment bank
On “multishipping” process
$this->_redirect('*/*/success');
redirection is hard coded to “success”
Could you explain the important difference ?
Thank you very much !
|