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


PHP Mage_Core_Controller_Front_Action::preDispatch方法代码示例

本文整理汇总了PHP中Mage_Core_Controller_Front_Action::preDispatch方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Controller_Front_Action::preDispatch方法的具体用法?PHP Mage_Core_Controller_Front_Action::preDispatch怎么用?PHP Mage_Core_Controller_Front_Action::preDispatch使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Core_Controller_Front_Action的用法示例。


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

示例1: preDispatch

 /**
  * Make sure the customer is authenticated of necessary
  *
  * @return Mage_Core_Controller_Front_Action | void
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if (!$this->getRequest()->isDispatched()) {
         return;
     }
     $authenticationRequired = (bool) Mage::getStoreConfig(Solvingmagento_AffiliateProduct_Model_Product_Type::XML_PATH_AUTHENTICATION);
     if ($authenticationRequired) {
         $customer = Mage::getSingleton('customer/session')->getCustomer();
         if ($customer && $customer->getId()) {
             $validationResult = $customer->validate();
             if (true !== $validationResult && is_array($validationResult)) {
                 foreach ($validationResult as $error) {
                     Mage::getSingleton('core/session')->addError($error);
                 }
                 $this->goBack();
                 $this->setFlag('', self::FLAG_NO_DISPATCH, true);
                 return $this;
             }
             return $this;
         } else {
             Mage::getSingleton('customer/session')->addError($this->helper->__('You must log in to access the partner product'));
             $this->_redirect('customer/account/login');
             $this->setFlag('', self::FLAG_NO_DISPATCH, true);
             return $this;
         }
     }
 }
开发者ID:hafeez3000,项目名称:Solvingmagento_AffiliateProduct,代码行数:33,代码来源:RedirectController.php

示例2: preDispatch

 /**
  * Ensure that the a database connection exists
  * If not, do load the route
  *
  * @return $this
  */
 public function preDispatch()
 {
     if (Mage::registry('wordpress_controller')) {
         Mage::unregister('wordpress_controller');
     }
     Mage::register('wordpress_controller', $this);
     parent::preDispatch();
     try {
         if (!$this->_canRunUsingConfig()) {
             $this->_forceForwardViaException('noRoute');
             return;
         }
         if ($this->getRequest()->getParam('feed_type')) {
             $this->getRequest()->setParam('feed', $this->getRequest()->getParam('feed_type'));
             // Legacy fix
             if (strpos(strtolower($this->getRequest()->getActionName()), 'feed') === false) {
                 $this->_forceForwardViaException('feed');
                 return;
             }
         }
     } catch (Mage_Core_Controller_Varien_Exception $e) {
         throw $e;
     } catch (Exception $e) {
         Mage::helper('wordpress')->log($e->getMessage());
         $this->_forceForwardViaException('noRoute');
         return;
     }
     // Check for redirects and forwards
     $transport = new Varien_Object();
     Mage::dispatchEvent('wordpress_' . strtolower(substr(get_class($this), strlen('Fishpig_Wordpress_'), -strlen('Controller'))) . '_controller_pre_dispatch_after', array('transport' => $transport, 'action' => $this));
     if ($transport->getForward()) {
         return $this->_forward($transport->getForward()->getAction(), $transport->getForward()->getController(), $transport->getForward()->getModule());
     }
     return $this;
 }
开发者ID:linusshops,项目名称:mirror-connect20-fishpig-wordpress-integration,代码行数:41,代码来源:Abstract.php

示例3: preDispatch

 /**
  * Predispatch: shoud set layout area
  *
  * @return Mage_Core_Controller_Front_Action
  */
 public function preDispatch()
 {
     try {
         // call the parents class method
         parent::preDispatch();
         // resolve the needed parameters from the requested resource name
         $this->_params = Mage::helper('channel')->resolve($this->getRequest()->getRequestString());
         // return the instance itself
         return $this;
     } catch (Faett_Channel_Exceptions_ResourceNotFoundException $rnfe) {
         // log the exception
         Mage::logException($rnfe);
         // register the error message
         Mage::register(Faett_Channel_Block_NotFound::MESSAGE, $this->_getHelper()->__($rnfe->getKey()));
         // forward to the not found page
         $this->_forward('notFound', 'error', 'channel');
     } catch (Exception $e) {
         // log the exception
         Mage::logException($e);
         // register the error message
         Mage::register(Faett_Channel_Block_InternalServerError::MESSAGE, $e->getMessage());
         // forward to the internal server error page
         $this->_forward('internalServerError', 'error', 'channel');
     }
 }
开发者ID:BGCX067,项目名称:faett-channel-svn-to-git,代码行数:30,代码来源:IndexController.php

示例4: preDispatch

 /**
  * Ensure that the a database connection exists
  * If not, do load the route
  *
  * @return $this
  */
 public function preDispatch()
 {
     if (Mage::registry('wordpress_controller')) {
         Mage::unregister('wordpress_controller');
     }
     Mage::register('wordpress_controller', $this);
     parent::preDispatch();
     try {
         if (!$this->_canRunUsingConfig()) {
             $this->_forceForwardViaException('noRoute');
             return;
         }
         if ($this->getRequest()->getParam('feed')) {
             if (strpos(strtolower($this->getRequest()->getActionName()), 'feed') === false) {
                 $this->_forceForwardViaException('feed');
                 return;
             }
         }
     } catch (Mage_Core_Controller_Varien_Exception $e) {
         throw $e;
     } catch (Exception $e) {
         Mage::helper('wordpress')->log($e->getMessage());
         $this->_forceForwardViaException('noRoute');
         return;
     }
     return $this;
 }
开发者ID:adampmoss,项目名称:hutch,代码行数:33,代码来源:Abstract.php

示例5: preDispatch

 /**
  * Use 'admin' store and prevent the session from starting
  *
  * @return Mage_Api_Controller_Action
  */
 public function preDispatch()
 {
     Mage::app()->setCurrentStore('admin');
     $this->setFlag('', self::FLAG_NO_START_SESSION, 1);
     parent::preDispatch();
     return $this;
 }
开发者ID:nemphys,项目名称:magento2,代码行数:12,代码来源:Action.php

示例6: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     $this->apiUrl = Mage::getStoreConfig(self::WMS_API_URL);
     $this->apiUser = Mage::getStoreConfig(self::WMS_API_USER);
     $this->apiPassword = Mage::getStoreConfig(self::WMS_API_PASSWORD);
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:7,代码来源:IndexController.php

示例7: preDispatch

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

示例8: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     if (!Mage::getStoreConfigFlag(self::XML_PATH_ENABLED)) {
         $this->norouteAction();
     }
 }
开发者ID:cesarfelip3,项目名称:clevermage_new,代码行数:7,代码来源:IndexController.php

示例9: preDispatch

 /**
  * disables any punchnout only tests
  *
  * @return Mage_Core_Controller_Front_Action|void
  */
 public function preDispatch()
 {
     // for any actions within this controller, disable the punchout only test.
     $event = Mage::getConfig()->getEventConfig('frontend', 'controller_action_predispatch');
     $event->observers->session_check_punchout_only->type = 'disabled';
     parent::preDispatch();
 }
开发者ID:Eximagen,项目名称:pfizer,代码行数:12,代码来源:2goController.php

示例10: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
         $this->_redirectUrl(Mage::helper('customer')->getAccountUrl());
     }
 }
开发者ID:7ochem,项目名称:magento_extension,代码行数:7,代码来源:TicketsController.php

示例11: preDispatch

 /**
  * Action predispatch
  *
  * Check customer authentication for some actions
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if (!Mage::getSingleton('customer/session')->authenticate($this)) {
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
     }
 }
开发者ID:okite11,项目名称:frames21,代码行数:12,代码来源:CustomerController.php

示例12: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     if (!Mage::getStoreConfigFlag('productlist/general_setting/show')) {
         $this->norouteAction();
     }
 }
开发者ID:TusharKDonda,项目名称:maruti,代码行数:7,代码来源:IndexController.php

示例13: preDispatch

 public function preDispatch()
 {
     parent::preDispatch();
     if (!$this->_getSession()->authenticate($this) || !Mage::helper('palorus')->isVaultEnabled()) {
         $this->setFlag('', 'no-dispatch', true);
     }
 }
开发者ID:nengineer,项目名称:litle-integration-magento,代码行数:7,代码来源:VaultController.php

示例14: preDispatch

 public function preDispatch()
 {
     $this->setFlag('', self::FLAG_NO_START_SESSION, 1);
     // Do not start standart session
     parent::preDispatch();
     return $this;
 }
开发者ID:HelioFreitas,项目名称:magento-pt_br,代码行数:7,代码来源:Action.php

示例15: preDispatch

 /**
  * require login when access this controller
  */
 public function preDispatch()
 {
     parent::preDispatch();
     if (!$this->getRequest()->isDispatched()) {
         return;
     }
     // David - Update create user
     if (Mage::helper('usermanagement')->isEnable() && Mage::getSingleton('customer/session')->getCustomerId() && !Mage::helper('usermanagement')->isExistUser()) {
         // Create new user
         Mage::getSingleton('usermanagement/observer')->customerRegister(new Varien_Object(array('customer' => Mage::getSingleton('customer/session')->getCustomer())));
     }
     // David - End update create user
     if (!Mage::helper('usermanagement')->isEnable() || !Mage::helper('usermanagement')->isExistUser()) {
         $this->_redirect('customer/account');
         $this->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
         return;
     }
     if (!Mage::getSingleton('customer/session')->authenticate($this)) {
         $this->setFlag('', Mage_Core_Controller_Varien_Action::FLAG_NO_DISPATCH, true);
     } else {
         $user = Mage::getSingleton('core/session')->getData('usermanagement_user');
         if (!$user || !$user->getId()) {
             $customer = Mage::getSingleton('customer/session')->getCustomer();
             $user = Mage::getModel('usermanagement/user')->load($customer->getId(), 'customer_id');
             Mage::getSingleton('core/session')->setData('usermanagement_user', $user);
         }
     }
 }
开发者ID:Thinlt,项目名称:simicart,代码行数:31,代码来源:ConfigurationController.php


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