liq*_*ity 12
另一种可能性是重载客户/帐户/创建操作,并在调用此操作时将用户重定向到主页.
第一次,只做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>
Run Code Online (Sandbox Code Playgroud)
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>
Run Code Online (Sandbox Code Playgroud)
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('*/*');
}
}
Run Code Online (Sandbox Code Playgroud)
8-创建 app/code/local/Mycompany/Registrationremove/Helper/Data.php
复制并粘贴Data.php:
class Mycompany_Registrationremove_Helper_Data extends Mage_Core_Helper_Abstract
{
}
Run Code Online (Sandbox Code Playgroud)
现在,当有人试图访问customer/account/create /时,应将其重定向到主页.
希望有帮助:)
雨果.
您可以修改登录屏幕以删除"创建新帐户"按钮.这样,现有用户仍然可以登录,但他们无法创建新帐户.
要修改的文件是/app/design/frontend/default/default/template/customer/form/login.phtml.你会看到第41行<div class="col-1 new-users">.注释掉整个div以隐藏登录页面的"新用户"部分.
编辑:
没有办法像你要求的那样禁用新的用户注册.我做了一点搜索,以及所有我发现几个人用同样的 想法为我的.除了我的原始建议,我会
a)删除<customer_account_create>/app/design/frontend/default/default/layout/custom.xml 的部分,
b)从/ app/design/frontend/default中删除与注册相关的行/default/template/checkout/onepage/login.phtml.
好的。我成功了。参考Hugues Solution,有两处修正:
添加 app\etc\modules\Mycompany_All.xml
Run Code Online (Sandbox Code Playgroud)<?xml version="1.0"?> <config> <modules> <Mycompany_Registrationremove> <active>true</active> <codePool>local</codePool> </Mycompany_Registrationremove> </modules> </config>
修改文件:app/code/local/Mycompany/Registrationremove/etc/config.xml
Run Code Online (Sandbox Code Playgroud)<?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> <mycompany_registrationremove> <use>standard</use> <args> <module>Mycompany_Registrationremove</module> <frontName>registrationremove</frontName> </args> </mycompany_registrationremove> </routers> </frontend> </config>
| 归档时间: |
|
| 查看次数: |
23489 次 |
| 最近记录: |