从Magento网站限制中排除页面
我们有几个magento网站,其中一些我们希望打开网站限制,以便只有登录的客户才能查看。这似乎工作得很好,除了我们有自定义页面,我们希望用户能够访问而不必登录。当前,如果我们打开访问限制,它会将所有页面(除了登录页面和密码重置页面)重定向到登录页面 有人知道如何排除其他页面被重定向到登录页面吗?我认为这将是一个布局xml设置,但我似乎无法理解或找到任何关于它的内容从Magento网站限制中排除页面,magento,Magento,我们有几个magento网站,其中一些我们希望打开网站限制,以便只有登录的客户才能查看。这似乎工作得很好,除了我们有自定义页面,我们希望用户能够访问而不必登录。当前,如果我们打开访问限制,它会将所有页面(除了登录页面和密码重置页面)重定向到登录页面 有人知道如何排除其他页面被重定向到登录页面吗?我认为这将是一个布局xml设置,但我似乎无法理解或找到任何关于它的内容 Magento企业版1.12.02尼克,此功能有几个过程 步骤1:您可以使用dispatch event从控制器中删除它 /**
Magento企业版1.12.02尼克,此功能有几个过程 步骤1:您可以使用dispatch event从控制器中删除它
/**
* Retrieve customer session model object
*
* @return Mage_Customer_Model_Session
*/
protected function _getSession()
{
return Mage::getSingleton('customer/session');
}
public function preDispatch()
{
// a brute-force protection here would be nice
parent::preDispatch();
if (!$this->getRequest()->isDispatched()) {
return;
}
$action = $this->getRequest()->getActionName();
/* put all action of this controllers for check ,if any actions of list is exit then redirect to login page*/
$openActions = array(
'index',
'post',
'autoy',
'confirmation'
);
$pattern = '/^(' . implode('|', $openActions) . ')/i';
if (!preg_match($pattern, $action)) {
if (!$this->_getSession()->authenticate($this)) {
$this->setFlag('', 'no-dispatch', true);
}
} else {
$this->_getSession()->setNoReferer(true);
}
}
/**
* Action postdispatch
*
* Remove No-referer flag from customer session after each action
*/
public function postDispatch()
{
parent::postDispatch();
$this->_getSession()->unsNoReferer(false);
}
另一件事是使用observer,这个问题非常有效,相当古老,在谷歌搜索结果中排名很高,但没有一个好的答案。所以这里有一个 将页面从限制中排除的正确方法是将它们添加到Enterprise_WebsiteRestriction module config下的页面列表中 具体请参见
app/code/core/Enterprise/WebsiteRestriction/etx/config.xml
和config/frontend/Enterprise/WebsiteRestriction
部分。无论设置了何种限制级别,始终可以访问full\u action\u names/generic
下的页面。当限制模式设置为“登录和注册”时,完整操作名称/注册中的那些文件仍然可以访问,即,它们旨在实现新的注册
这些部分下的值是完整的动作名称(即\uuu
),因此,要为每个人启用联系人表单,您需要将联系人索引
添加到通用
列表中
请注意,在核心代码池中编辑文件是非常困难的,所以要实现这一点,最好创建您自己的模块并添加配置部分
它看起来应该有点像这样(请记住在app/etc/modules
中启用此模块):
0.1.0
我喜欢这个答案的外观。我将很快尝试,感谢您抽出时间回答。