当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Checkout_Controller_Action类代码示例

本文整理汇总了PHP中Mage_Checkout_Controller_Action的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Checkout_Controller_Action类的具体用法?PHP Mage_Checkout_Controller_Action怎么用?PHP Mage_Checkout_Controller_Action使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Mage_Checkout_Controller_Action类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: preDispatch

 /**
  * Action predispatch
  *
  * Check customer authentication for some actions
  *
  * @return Mage_Checkout_MultishippingController
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $action = $this->getRequest()->getActionName();
     if (!preg_match('#^(login|register)#', $action)) {
         if (!AO::getSingleton('customer/session')->authenticate($this, $this->_getHelper()->getMSLoginUrl())) {
             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         }
         if (!AO::helper('checkout')->isMultishippingCheckoutAvailable()) {
             $this->_redirectUrl($this->_getHelper()->getCartUrl());
             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
             return $this;
         }
     }
     if (!$this->_preDispatchValidateCustomer()) {
         return $this;
     }
     if (AO::getSingleton('checkout/session')->getCartWasUpdated(true) && !in_array($action, array('index', 'login', 'register', 'addresses', 'success'))) {
         $this->_redirectUrl($this->_getHelper()->getCartUrl());
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
     }
     if ($action == 'success' && $this->_getCheckout()->getCheckoutSession()->getDisplaySuccess(true)) {
         return $this;
     }
     $quote = $this->_getCheckout()->getQuote();
     if (!$quote->hasItems() || $quote->getHasError() || $quote->isVirtual()) {
         $this->_redirectUrl($this->_getHelper()->getCartUrl());
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return;
     }
     return $this;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:39,代码来源:MultishippingController.php

示例2: preDispatch

 /**
  * Check if customer is logged in or not
  * If not logged in then redirect to customer login
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if (!Mage::getSingleton('customer/session')->authenticate($this)) {
         $this->setFlag('', 'no-dispatch', true);
     }
 }
开发者ID:picode-eu,项目名称:nti_mage,代码行数:11,代码来源:UpdateController.php

示例3: preDispatch

 /**
  * @return Mage_Checkout_OnepageController
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if (!$this->_preDispatchValidateCustomer()) {
         return $this;
     }
     return $this;
 }
开发者ID:Rinso,项目名称:magento-mirror,代码行数:11,代码来源:OnepageController.php

示例4: preDispatch

 /**
  * Pre dispatch hook. Remove addresses created by multishipping checkout
  *
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $checkoutSessionQuote = Mage::getSingleton('checkout/session')->getQuote();
     if ($checkoutSessionQuote->getIsMultiShipping()) {
         $checkoutSessionQuote->setIsMultiShipping(false);
         $checkoutSessionQuote->removeAllAddresses();
     }
     return $this;
 }
开发者ID:xiaoguizhidao,项目名称:autotech_design,代码行数:14,代码来源:CheckoutController.php

示例5: preDispatch

 /**
  * @return Mage_Checkout_OnepageController
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_preDispatchValidateCustomer();
     $checkoutSessionQuote = Mage::getSingleton('checkout/session')->getQuote();
     if ($checkoutSessionQuote->getIsMultiShipping()) {
         $checkoutSessionQuote->setIsMultiShipping(false);
         $checkoutSessionQuote->removeAllAddresses();
     }
     if ($this->getRequest()->getActionName() != 'success') {
         Mage::helper('anattadesign_awesomecheckout')->estimateShipping();
     }
     return $this;
 }
开发者ID:anattadesign,项目名称:AwesomeCheckout,代码行数:17,代码来源:OnepageController.php

示例6: preDispatch

 /**
  * Action predispatch
  *
  * Check customer authentication for some actions
  *
  * @return Mage_Checkout_MultishippingController
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if ($this->getFlag('', 'redirectLogin')) {
         return $this;
     }
     $action = strtolower($this->getRequest()->getActionName());
     $checkoutSessionQuote = $this->_getCheckoutSession()->getQuote();
     /**
      * Catch index action call to set some flags before checkout/type_multishipping model initialization
      */
     if ($action == 'index') {
         $checkoutSessionQuote->setIsMultiShipping(true);
         $this->_getCheckoutSession()->setCheckoutState(Mage_Checkout_Model_Session::CHECKOUT_STATE_BEGIN);
     } elseif (!$checkoutSessionQuote->getIsMultiShipping() && !in_array($action, array('login', 'register', 'success'))) {
         $this->_redirect('*/*/index');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (!in_array($action, array('login', 'register'))) {
         if (!Mage::getSingleton('customer/session')->authenticate($this, $this->_getHelper()->getMSLoginUrl())) {
             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         }
         if (!Mage::helper('checkout')->isMultishippingCheckoutAvailable()) {
             $error = $this->_getCheckout()->getMinimumAmountError();
             $this->_getCheckoutSession()->addError($error);
             $this->_redirectUrl($this->_getHelper()->getCartUrl());
             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
             return $this;
         }
     }
     if (!$this->_preDispatchValidateCustomer()) {
         return $this;
     }
     if ($this->_getCheckoutSession()->getCartWasUpdated(true) && !in_array($action, array('index', 'login', 'register', 'addresses', 'success'))) {
         $this->_redirectUrl($this->_getHelper()->getCartUrl());
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
     }
     if ($action == 'success' && $this->_getCheckout()->getCheckoutSession()->getDisplaySuccess(true)) {
         return $this;
     }
     $quote = $this->_getCheckout()->getQuote();
     if (!$quote->hasItems() || $quote->getHasError() || $quote->isVirtual()) {
         $this->_redirectUrl($this->_getHelper()->getCartUrl());
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return;
     }
     return $this;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:56,代码来源:MultishippingController.php

示例7: preDispatch

 /**
  * @return Mage_Checkout_OnepageController
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_preDispatchValidateCustomer();
     $checkoutSessionQuote = Mage::getSingleton('buyback/session')->getQuote();
     if ($checkoutSessionQuote->getIsMultiShipping()) {
         $checkoutSessionQuote->setIsMultiShipping(false);
         $checkoutSessionQuote->removeAllAddresses();
     }
     if (!$this->_canShowForUnregisteredUsers()) {
         $this->norouteAction();
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return;
     }
     return $this;
 }
开发者ID:pcuervo,项目名称:gadfy,代码行数:19,代码来源:OnepageController.php

示例8: preDispatch

 /**
  * Check query string paramters for order reference and/or access token
  */
 public function preDispatch()
 {
     parent::preDispatch();
     $this->_amazonOrderReferenceId = htmlentities($this->getRequest()->getParam('amazon_order_reference_id'));
     if (!$this->_amazonOrderReferenceId) {
         $this->_amazonOrderReferenceId = Mage::getSingleton('checkout/session')->getAmazonOrderReferenceId();
     } else {
         Mage::getSingleton('checkout/session')->setAmazonOrderReferenceId($this->_amazonOrderReferenceId);
     }
     // User is logging in...
     $token = htmlentities($this->getRequest()->getParam('access_token'));
     if ($token) {
         $_amazonLogin = Mage::getModel('amazon_login/customer');
         if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
             if (!$this->_getConfig()->isGuestCheckout() || !$this->_getOnepage()->getQuote()->isAllowedGuestCheckout()) {
                 $customer = $_amazonLogin->loginWithToken($token, $this->_checkoutUrl);
             } else {
                 $amazonProfile = $_amazonLogin->getAmazonProfile($token);
                 if ($amazonProfile && isset($amazonProfile['email'])) {
                     Mage::getSingleton('checkout/session')->setCustomerEmail($amazonProfile['email']);
                     Mage::getSingleton('checkout/session')->setCustomerName($amazonProfile['name']);
                 }
             }
         }
         Mage::getSingleton('checkout/session')->setAmazonAccessToken($token);
         // Full-page redirect (user did not sign in using popup)
         if ($this->getRequest()->getParam('nopopup')) {
             $this->_redirectUrl(Mage::helper('amazon_payments')->getCheckoutUrl(false) . '#access_token=' . $token);
         } else {
             if (Mage::app()->getRequest()->getParams('account') == 'redirect') {
                 $this->_redirect('customer/account');
             } else {
                 if (!$this->getRequest()->getParam('ajax')) {
                     $this->_redirect($this->_checkoutUrl, array('_secure' => true));
                     return;
                 }
             }
         }
     }
 }
开发者ID:frognrainbow,项目名称:amazon-payments-magento-plugin,代码行数:43,代码来源:Checkout.php


注:本文中的Mage_Checkout_Controller_Action类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。