如标题。
但是,用户仍然可以登录到前端,而管理员只能在后端创建用户帐户。
最佳答案
另一种可能是使客户/帐户/创建操作重载,并且在调用该操作时将用户重定向到主页。
第一次,可以按照Ben V的建议进行操作。这将消除查看注册页面的可能性。
然后,创建一个新模块,您将在其中重载AccountController.php。
1-用app/code/local/
创建一个名为Mycompany的新文件夹
2-在app/code/local/Mycompany/
中创建一个名为Registrationremove的新文件夹
3-创建app/code/local/Mycompany/Registrationremove/etc/
4-创建app/code/local/Mycompany/Registrationremove/etc/config.xml
复制并粘贴到config.xml中:
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Registrationremove>
<version>0.1.0</version>
</Mycompany_Registrationremove>
</modules>
<global>
<rewrite>
<mycompany_registrationremove_customer_account_create>
<from><![CDATA[#^/customer/account/create/$#]]></from>
<to>/registrationremove/customer_account/create</to>
</mycompany_registrationremove_customer_account_create>
<mycompany_registrationremove_customer_account_createPost>
<from><![CDATA[#^/customer/account/createPost/$#]]></from>
<to>/registrationremove/customer_account/createPost</to>
</mycompany_registrationremove_customer_account_createPost>
</rewrite>
</global>
<frontend>
<routers>
<registrationremove>
<use>standard</use>
<args>
<module>Mycompany_Registrationremove</module>
<frontName>registrationremove</frontName>
</args>
</registrationremove>
</routers>
</frontend>
</config>
5-创建
app/code/local/Mycompany/Registrationremove/controllers
6-创建
app/etc/modules/Mycompany_Registrationremove.xml
<?xml version="1.0"?>
<config>
<modules>
<Mycompany_Registrationremove>
<active>true</active>
<codePool>local</codePool>
</Mycompany_Registrationremove>
</modules>
</config>
7-创建
app/code/local/Mycompany/Registrationremove/controllers/Customer/AccountController.php
复制并粘贴到AccountController.php中:
require_once 'Mage/Customer/controllers/AccountController.php';
class Mycompany_Registrationremove_Customer_AccountController extends Mage_Customer_AccountController
{
public function createAction()
{
$this->_redirect('*/*');
}
public function createPostAction()
{
$this->_redirect('*/*');
}
}
8-创建
app/code/local/Mycompany/Registrationremove/Helper/Data.php
复制并粘贴到Data.php中:
class Mycompany_Registrationremove_Helper_Data extends Mage_Core_Helper_Abstract
{
}
现在,当有人尝试访问客户/帐户/创建/时,应将其重定向到主页。
希望有帮助:)
雨果。
关于magento - 如何在Magento中禁用前端注册,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/2959131/