Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Checkout_Block_Agreements
  • Mage_Checkout_Block_Cart
  • Mage_Checkout_Block_Cart_Abstract
  • Mage_Checkout_Block_Cart_Coupon
  • Mage_Checkout_Block_Cart_Crosssell
  • Mage_Checkout_Block_Cart_Item_Configure
  • Mage_Checkout_Block_Cart_Item_Renderer
  • Mage_Checkout_Block_Cart_Item_Renderer_Configurable
  • Mage_Checkout_Block_Cart_Item_Renderer_Grouped
  • Mage_Checkout_Block_Cart_Shipping
  • Mage_Checkout_Block_Cart_Sidebar
  • Mage_Checkout_Block_Cart_Totals
  • Mage_Checkout_Block_Links
  • Mage_Checkout_Block_Multishipping_Abstract
  • Mage_Checkout_Block_Multishipping_Address_Select
  • Mage_Checkout_Block_Multishipping_Addresses
  • Mage_Checkout_Block_Multishipping_Billing
  • Mage_Checkout_Block_Multishipping_Billing_Items
  • Mage_Checkout_Block_Multishipping_Link
  • Mage_Checkout_Block_Multishipping_Overview
  • Mage_Checkout_Block_Multishipping_Payment_Info
  • Mage_Checkout_Block_Multishipping_Shipping
  • Mage_Checkout_Block_Multishipping_State
  • Mage_Checkout_Block_Multishipping_Success
  • Mage_Checkout_Block_Onepage
  • Mage_Checkout_Block_Onepage_Abstract
  • Mage_Checkout_Block_Onepage_Billing
  • Mage_Checkout_Block_Onepage_Failure
  • Mage_Checkout_Block_Onepage_Link
  • Mage_Checkout_Block_Onepage_Login
  • Mage_Checkout_Block_Onepage_Payment
  • Mage_Checkout_Block_Onepage_Payment_Info
  • Mage_Checkout_Block_Onepage_Payment_Methods
  • Mage_Checkout_Block_Onepage_Progress
  • Mage_Checkout_Block_Onepage_Review
  • Mage_Checkout_Block_Onepage_Review_Info
  • Mage_Checkout_Block_Onepage_Shipping
  • Mage_Checkout_Block_Onepage_Shipping_Method
  • Mage_Checkout_Block_Onepage_Shipping_Method_Additional
  • Mage_Checkout_Block_Onepage_Shipping_Method_Available
  • Mage_Checkout_Block_Onepage_Success
  • Mage_Checkout_Block_Success
  • Mage_Checkout_Block_Total_Default
  • Mage_Checkout_Block_Total_Nominal
  • Mage_Checkout_Block_Total_Tax
  • Mage_Checkout_CartController
  • Mage_Checkout_Controller_Action
  • Mage_Checkout_Exception
  • Mage_Checkout_Helper_Cart
  • Mage_Checkout_Helper_Data
  • Mage_Checkout_Helper_Url
  • Mage_Checkout_IndexController
  • Mage_Checkout_Model_Agreement
  • Mage_Checkout_Model_Api_Resource
  • Mage_Checkout_Model_Api_Resource_Customer
  • Mage_Checkout_Model_Api_Resource_Product
  • Mage_Checkout_Model_Cart
  • Mage_Checkout_Model_Cart_Api
  • Mage_Checkout_Model_Cart_Api_V2
  • Mage_Checkout_Model_Cart_Coupon_Api
  • Mage_Checkout_Model_Cart_Coupon_Api_V2
  • Mage_Checkout_Model_Cart_Customer_Api
  • Mage_Checkout_Model_Cart_Customer_Api_V2
  • Mage_Checkout_Model_Cart_Payment_Api
  • Mage_Checkout_Model_Cart_Payment_Api_V2
  • Mage_Checkout_Model_Cart_Product_Api
  • Mage_Checkout_Model_Cart_Product_Api_V2
  • Mage_Checkout_Model_Cart_Shipping_Api
  • Mage_Checkout_Model_Cart_Shipping_Api_V2
  • Mage_Checkout_Model_Config_Source_Cart_Summary
  • Mage_Checkout_Model_Mysql4_Agreement
  • Mage_Checkout_Model_Mysql4_Agreement_Collection
  • Mage_Checkout_Model_Mysql4_Cart
  • Mage_Checkout_Model_Mysql4_Setup
  • Mage_Checkout_Model_Observer
  • Mage_Checkout_Model_Resource_Agreement
  • Mage_Checkout_Model_Resource_Agreement_Collection
  • Mage_Checkout_Model_Resource_Cart
  • Mage_Checkout_Model_Resource_Setup
  • Mage_Checkout_Model_Session
  • Mage_Checkout_Model_Type_Abstract
  • Mage_Checkout_Model_Type_Multishipping
  • Mage_Checkout_Model_Type_Multishipping_State
  • Mage_Checkout_Model_Type_Onepage
  • Mage_Checkout_Multishipping_AddressController
  • Mage_Checkout_MultishippingController
  • Mage_Checkout_OnepageController

Interfaces

  • Mage_Checkout_Model_Cart_Interface
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Checkout
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Multishipping checkout controller
 29:  *
 30:  * @author      Magento Core Team <core@magentocommerce.com>
 31:  */
 32: class Mage_Checkout_MultishippingController extends Mage_Checkout_Controller_Action
 33: {
 34:     /**
 35:      * Retrieve checkout model
 36:      *
 37:      * @return Mage_Checkout_Model_Type_Multishipping
 38:      */
 39:     protected function _getCheckout()
 40:     {
 41:         return Mage::getSingleton('checkout/type_multishipping');
 42:     }
 43: 
 44:     /**
 45:      * Retrieve checkout state model
 46:      *
 47:      * @return Mage_Checkout_Model_Type_Multishipping_State
 48:      */
 49:     protected function _getState()
 50:     {
 51:         return Mage::getSingleton('checkout/type_multishipping_state');
 52:     }
 53: 
 54:     /**
 55:      * Retrieve checkout url heler
 56:      *
 57:      * @return Mage_Checkout_Helper_Url
 58:      */
 59:     protected function _getHelper()
 60:     {
 61:         return Mage::helper('checkout/url');
 62:     }
 63: 
 64:     /**
 65:      * Retrieve checkout session
 66:      *
 67:      * @return Mage_Checkout_Model_Session
 68:      */
 69:     protected function _getCheckoutSession()
 70:     {
 71:         return Mage::getSingleton('checkout/session');
 72:     }
 73: 
 74:     /**
 75:      * Action predispatch
 76:      *
 77:      * Check customer authentication for some actions
 78:      *
 79:      * @return Mage_Checkout_MultishippingController
 80:      */
 81:     public function preDispatch()
 82:     {
 83:         parent::preDispatch();
 84: 
 85:         if ($this->getFlag('', 'redirectLogin')) {
 86:             return $this;
 87:         }
 88: 
 89:         $action = $this->getRequest()->getActionName();
 90: 
 91:         $checkoutSessionQuote = $this->_getCheckoutSession()->getQuote();
 92:         /**
 93:          * Catch index action call to set some flags before checkout/type_multishipping model initialization
 94:          */
 95:         if ($action == 'index') {
 96:             $checkoutSessionQuote->setIsMultiShipping(true);
 97:             $this->_getCheckoutSession()->setCheckoutState(
 98:                 Mage_Checkout_Model_Session::CHECKOUT_STATE_BEGIN
 99:             );
100:         } elseif (!$checkoutSessionQuote->getIsMultiShipping() &&
101:             !in_array($action, array('login', 'register', 'success'))
102:         ) {
103:             $this->_redirect('*/*/index');
104:             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
105:             return $this;
106:         }
107: 
108:         if (!in_array($action, array('login', 'register'))) {
109:             if (!Mage::getSingleton('customer/session')->authenticate($this, $this->_getHelper()->getMSLoginUrl())) {
110:                 $this->setFlag('', self::FLAG_NO_DISPATCH, true);
111:             }
112: 
113:             if (!Mage::helper('checkout')->isMultishippingCheckoutAvailable()) {
114:                 $error = $this->_getCheckout()->getMinimumAmountError();
115:                 $this->_getCheckoutSession()->addError($error);
116:                 $this->_redirectUrl($this->_getHelper()->getCartUrl());
117:                 $this->setFlag('', self::FLAG_NO_DISPATCH, true);
118:                 return $this;
119:             }
120:         }
121: 
122:         if (!$this->_preDispatchValidateCustomer()) {
123:             return $this;
124:         }
125: 
126:         if ($this->_getCheckoutSession()->getCartWasUpdated(true) &&
127:             !in_array($action, array('index', 'login', 'register', 'addresses', 'success'))
128:         ) {
129:             $this->_redirectUrl($this->_getHelper()->getCartUrl());
130:             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
131:         }
132: 
133:         if ($action == 'success' && $this->_getCheckout()->getCheckoutSession()->getDisplaySuccess(true)) {
134:             return $this;
135:         }
136: 
137:         $quote = $this->_getCheckout()->getQuote();
138:         if (!$quote->hasItems() || $quote->getHasError() || $quote->isVirtual()) {
139:             $this->_redirectUrl($this->_getHelper()->getCartUrl());
140:             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
141:             return;
142:         }
143: 
144:         return $this;
145:     }
146: 
147:     /**
148:      * Index action of Multishipping checkout
149:      */
150:     public function indexAction()
151:     {
152:         $this->_getCheckoutSession()->setCartWasUpdated(false);
153:         $this->_redirect('*/*/addresses');
154:     }
155: 
156:     /**
157:      * Multishipping checkout login page
158:      */
159:     public function loginAction()
160:     {
161:         if (Mage::getSingleton('customer/session')->isLoggedIn()) {
162:             $this->_redirect('*/*/');
163:             return;
164:         }
165: 
166:         $this->loadLayout();
167:         $this->_initLayoutMessages('customer/session');
168: 
169:         // set account create url
170:         if ($loginForm = $this->getLayout()->getBlock('customer_form_login')) {
171:             $loginForm->setCreateAccountUrl($this->_getHelper()->getMSRegisterUrl());
172:         }
173:         $this->renderLayout();
174:     }
175: 
176:     /**
177:      * Multishipping checkout login page
178:      */
179:     public function registerAction()
180:     {
181:         if (Mage::getSingleton('customer/session')->isLoggedIn()) {
182:             $this->_redirectUrl($this->_getHelper()->getMSCheckoutUrl());
183:             return;
184:         }
185: 
186:         $this->loadLayout();
187:         $this->_initLayoutMessages('customer/session');
188: 
189:         if ($registerForm = $this->getLayout()->getBlock('customer_form_register')) {
190:             $registerForm->setShowAddressFields(true)
191:                 ->setBackUrl($this->_getHelper()->getMSLoginUrl())
192:                 ->setSuccessUrl($this->_getHelper()->getMSShippingAddressSavedUrl())
193:                 ->setErrorUrl($this->_getHelper()->getCurrentUrl());
194:         }
195: 
196:         $this->renderLayout();
197:     }
198: 
199:     /**
200:      * Multishipping checkout select address page
201:      */
202:     public function addressesAction()
203:     {
204:         // If customer do not have addresses
205:         if (!$this->_getCheckout()->getCustomerDefaultShippingAddress()) {
206:             $this->_redirect('*/multishipping_address/newShipping');
207:             return;
208:         }
209: 
210:         $this->_getState()->unsCompleteStep(
211:             Mage_Checkout_Model_Type_Multishipping_State::STEP_SHIPPING
212:         );
213: 
214:         $this->_getState()->setActiveStep(
215:             Mage_Checkout_Model_Type_Multishipping_State::STEP_SELECT_ADDRESSES
216:         );
217:         if (!$this->_getCheckout()->validateMinimumAmount()) {
218:             $message = $this->_getCheckout()->getMinimumAmountDescription();
219:             $this->_getCheckout()->getCheckoutSession()->addNotice($message);
220:         }
221:         $this->loadLayout();
222:         $this->_initLayoutMessages('customer/session');
223:         $this->_initLayoutMessages('checkout/session');
224:         $this->renderLayout();
225:     }
226: 
227:     /**
228:      * Multishipping checkout process posted addresses
229:      */
230:     public function addressesPostAction()
231:     {
232:         if (!$this->_getCheckout()->getCustomerDefaultShippingAddress()) {
233:             $this->_redirect('*/multishipping_address/newShipping');
234:             return;
235:         }
236:         try {
237:             if ($this->getRequest()->getParam('continue', false)) {
238:                 $this->_getCheckout()->setCollectRatesFlag(true);
239:                 $this->_getState()->setActiveStep(
240:                     Mage_Checkout_Model_Type_Multishipping_State::STEP_SHIPPING
241:                 );
242:                 $this->_getState()->setCompleteStep(
243:                     Mage_Checkout_Model_Type_Multishipping_State::STEP_SELECT_ADDRESSES
244:                 );
245:                 $this->_redirect('*/*/shipping');
246:             }
247:             elseif ($this->getRequest()->getParam('new_address')) {
248:                 $this->_redirect('*/multishipping_address/newShipping');
249:             }
250:             else {
251:                 $this->_redirect('*/*/addresses');
252:             }
253:             if ($shipToInfo = $this->getRequest()->getPost('ship')) {
254:                 $this->_getCheckout()->setShippingItemsInformation($shipToInfo);
255:             }
256:         }
257:         catch (Mage_Core_Exception $e) {
258:             $this->_getCheckoutSession()->addError($e->getMessage());
259:             $this->_redirect('*/*/addresses');
260:         }
261:         catch (Exception $e) {
262:             $this->_getCheckoutSession()->addException(
263:                 $e,
264:                 Mage::helper('checkout')->__('Data saving problem')
265:             );
266:             $this->_redirect('*/*/addresses');
267:         }
268:     }
269: 
270:     public function backToAddressesAction()
271:     {
272:         $this->_getState()->setActiveStep(
273:             Mage_Checkout_Model_Type_Multishipping_State::STEP_SELECT_ADDRESSES
274:         );
275:         $this->_getState()->unsCompleteStep(
276:             Mage_Checkout_Model_Type_Multishipping_State::STEP_SHIPPING
277:         );
278:         $this->_redirect('*/*/addresses');
279:     }
280: 
281:     /**
282:      * Multishipping checkout remove item action
283:      */
284:     public function removeItemAction()
285:     {
286:         $itemId     = $this->getRequest()->getParam('id');
287:         $addressId  = $this->getRequest()->getParam('address');
288:         if ($addressId && $itemId) {
289:             $this->_getCheckout()->setCollectRatesFlag(true);
290:             $this->_getCheckout()->removeAddressItem($addressId, $itemId);
291:         }
292:         $this->_redirect('*/*/addresses');
293:     }
294: 
295:     protected function _validateMinimumAmount()
296:     {
297:         if (!$this->_getCheckout()->validateMinimumAmount()) {
298:             $error = $this->_getCheckout()->getMinimumAmountError();
299:             $this->_getCheckout()->getCheckoutSession()->addError($error);
300:             $this->_forward('backToAddresses');
301:             return false;
302:         }
303:         return true;
304:     }
305: 
306:     /**
307:      * Multishipping checkout shipping information page
308:      */
309:     public function shippingAction()
310:     {
311:         if (!$this->_validateMinimumAmount()) {
312:             return;
313:         }
314: 
315:         if (!$this->_getState()->getCompleteStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_SELECT_ADDRESSES)) {
316:             $this->_redirect('*/*/addresses');
317:             return $this;
318:         }
319: 
320:         $this->_getState()->setActiveStep(
321:             Mage_Checkout_Model_Type_Multishipping_State::STEP_SHIPPING
322:         );
323:         $this->loadLayout();
324:         $this->_initLayoutMessages('customer/session');
325:         $this->_initLayoutMessages('checkout/session');
326:         $this->renderLayout();
327:     }
328: 
329:     public function backToShippingAction()
330:     {
331:         $this->_getState()->setActiveStep(
332:             Mage_Checkout_Model_Type_Multishipping_State::STEP_SHIPPING
333:         );
334:         $this->_getState()->unsCompleteStep(
335:             Mage_Checkout_Model_Type_Multishipping_State::STEP_BILLING
336:         );
337:         $this->_redirect('*/*/shipping');
338:     }
339: 
340:     public function shippingPostAction()
341:     {
342:         $shippingMethods = $this->getRequest()->getPost('shipping_method');
343:         try {
344:             Mage::dispatchEvent(
345:                 'checkout_controller_multishipping_shipping_post',
346:                 array('request'=>$this->getRequest(), 'quote'=>$this->_getCheckout()->getQuote())
347:             );
348:             $this->_getCheckout()->setShippingMethods($shippingMethods);
349:             $this->_getState()->setActiveStep(
350:                 Mage_Checkout_Model_Type_Multishipping_State::STEP_BILLING
351:             );
352:             $this->_getState()->setCompleteStep(
353:                 Mage_Checkout_Model_Type_Multishipping_State::STEP_SHIPPING
354:             );
355:             $this->_redirect('*/*/billing');
356:         }
357:         catch (Exception $e){
358:             $this->_getCheckoutSession()->addError($e->getMessage());
359:             $this->_redirect('*/*/shipping');
360:         }
361:     }
362: 
363:     /**
364:      * Multishipping checkout billing information page
365:      */
366:     public function billingAction()
367:     {
368:         if (!$this->_validateBilling()) {
369:             return;
370:         }
371: 
372:         if (!$this->_validateMinimumAmount()) {
373:             return;
374:         }
375: 
376:         if (!$this->_getState()->getCompleteStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_SHIPPING)) {
377:             $this->_redirect('*/*/shipping');
378:             return $this;
379:         }
380: 
381:         $this->_getState()->setActiveStep(
382:             Mage_Checkout_Model_Type_Multishipping_State::STEP_BILLING
383:         );
384: 
385:         $this->loadLayout();
386:         $this->_initLayoutMessages('customer/session');
387:         $this->_initLayoutMessages('checkout/session');
388:         $this->renderLayout();
389:     }
390: 
391: //    public function billingPostAction()
392: //    {
393: //        if(!$this->_validateBilling()) {
394: //            return;
395: //        }
396: //
397: //        $payment = $this->getRequest()->getPost('payment');
398: //        try {
399: //            $this->_getCheckout()->setPaymentMethod($payment);
400: //            $this->_getState()->setActiveStep(
401: //                Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW
402: //            );
403: //            $this->_redirect('*/*/overview');
404: //        }
405: //        catch (Exception $e) {
406: //            $this->_getCheckoutSession()->addError($e->getMessage());
407: //            $this->_redirect('*/*/billing');
408: //        }
409: //    }
410: 
411:     /**
412:      * Validation of selecting of billing address
413:      *
414:      * @return boolean
415:      */
416:     protected function _validateBilling()
417:     {
418:         if(!$this->_getCheckout()->getQuote()->getBillingAddress()->getFirstname()) {
419:             $this->_redirect('*/multishipping_address/selectBilling');
420:             return false;
421:         }
422:         return true;
423:     }
424: 
425:     public function backToBillingAction()
426:     {
427:         $this->_getState()->setActiveStep(
428:             Mage_Checkout_Model_Type_Multishipping_State::STEP_BILLING
429:         );
430:         $this->_getState()->unsCompleteStep(
431:             Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW
432:         );
433:         $this->_redirect('*/*/billing');
434:     }
435: 
436:     /**
437:      * Multishipping checkout place order page
438:      */
439:     public function overviewAction()
440:     {
441:         if (!$this->_validateMinimumAmount()) {
442:             return $this;
443:         }
444: 
445:         $this->_getState()->setActiveStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW);
446: 
447:         try {
448:             $payment = $this->getRequest()->getPost('payment');
449:             $this->_getCheckout()->setPaymentMethod($payment);
450: 
451:             $this->_getState()->setCompleteStep(
452:                 Mage_Checkout_Model_Type_Multishipping_State::STEP_BILLING
453:             );
454: 
455:             $this->loadLayout();
456:             $this->_initLayoutMessages('checkout/session');
457:             $this->_initLayoutMessages('customer/session');
458:             $this->renderLayout();
459:         }
460:         catch (Mage_Core_Exception $e) {
461:             $this->_getCheckoutSession()->addError($e->getMessage());
462:             $this->_redirect('*/*/billing');
463:         }
464:         catch (Exception $e) {
465:             Mage::logException($e);
466:             $this->_getCheckoutSession()->addException($e, $this->__('Cannot open the overview page'));
467:             $this->_redirect('*/*/billing');
468:         }
469:     }
470: 
471:     public function overviewPostAction()
472:     {
473:         if (!$this->_validateMinimumAmount()) {
474:             return;
475:         }
476: 
477:         try {
478:             if ($requiredAgreements = Mage::helper('checkout')->getRequiredAgreementIds()) {
479:                 $postedAgreements = array_keys($this->getRequest()->getPost('agreement', array()));
480:                 if ($diff = array_diff($requiredAgreements, $postedAgreements)) {
481:                     $this->_getCheckoutSession()->addError($this->__('Please agree to all Terms and Conditions before placing the order.'));
482:                     $this->_redirect('*/*/billing');
483:                     return;
484:                 }
485:             }
486: 
487:             $payment = $this->getRequest()->getPost('payment');
488:             $paymentInstance = $this->_getCheckout()->getQuote()->getPayment();
489:             if (isset($payment['cc_number'])) {
490:                 $paymentInstance->setCcNumber($payment['cc_number']);
491:             }
492:             if (isset($payment['cc_cid'])) {
493:                 $paymentInstance->setCcCid($payment['cc_cid']);
494:             }
495:             $this->_getCheckout()->createOrders();
496:             $this->_getState()->setActiveStep(
497:                 Mage_Checkout_Model_Type_Multishipping_State::STEP_SUCCESS
498:             );
499:             $this->_getState()->setCompleteStep(
500:                 Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW
501:             );
502:             $this->_getCheckout()->getCheckoutSession()->clear();
503:             $this->_getCheckout()->getCheckoutSession()->setDisplaySuccess(true);
504:             $this->_redirect('*/*/success');
505:         } catch (Mage_Payment_Model_Info_Exception $e) {
506:             $message = $e->getMessage();
507:             if( !empty($message) ) {
508:                 $this->_getCheckoutSession()->addError($message);
509:             }
510:             $this->_redirect('*/*/billing');
511:         } catch (Mage_Checkout_Exception $e) {
512:             Mage::helper('checkout')
513:                 ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping');
514:             $this->_getCheckout()->getCheckoutSession()->clear();
515:             $this->_getCheckoutSession()->addError($e->getMessage());
516:             $this->_redirect('*/cart');
517:         }
518:         catch (Mage_Core_Exception $e){
519:             Mage::helper('checkout')
520:                 ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping');
521:             $this->_getCheckoutSession()->addError($e->getMessage());
522:             $this->_redirect('*/*/billing');
523:         } catch (Exception $e){
524:             Mage::logException($e);
525:             Mage::helper('checkout')
526:                 ->sendPaymentFailedEmail($this->_getCheckout()->getQuote(), $e->getMessage(), 'multi-shipping');
527:             $this->_getCheckoutSession()->addError($this->__('Order place error.'));
528:             $this->_redirect('*/*/billing');
529:         }
530:     }
531: 
532:     /**
533:      * Multishipping checkout succes page
534:      */
535:     public function successAction()
536:     {
537:         if (!$this->_getState()->getCompleteStep(Mage_Checkout_Model_Type_Multishipping_State::STEP_OVERVIEW)) {
538:             $this->_redirect('*/*/addresses');
539:             return $this;
540:         }
541: 
542:         $this->loadLayout();
543:         $this->_initLayoutMessages('checkout/session');
544:         $ids = $this->_getCheckout()->getOrderIds();
545:         Mage::dispatchEvent('checkout_multishipping_controller_success_action', array('order_ids' => $ids));
546:         $this->renderLayout();
547:     }
548: 
549:     /**
550:      * Redirect to login page
551:      *
552:      */
553:     public function redirectLogin()
554:     {
555:         $this->setFlag('', 'no-dispatch', true);
556:         Mage::getSingleton('customer/session')->setBeforeAuthUrl(Mage::getUrl('*/*', array('_secure'=>true)));
557: 
558:         $this->getResponse()->setRedirect(
559:             Mage::helper('core/url')->addRequestParam(
560:                 $this->_getHelper()->getMSLoginUrl(),
561:                 array('context' => 'checkout')
562:             )
563:         );
564: 
565:         $this->setFlag('', 'redirectLogin', true);
566:     }
567: }
568: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0