我跟着 本教程 要在Magento下的客户的注册形式中添加字段,我成功地运行了示例,但我知道它不是干净的,因为稍后是向上...

什么是以干净的方式重写教程中使用的所有文件的最佳方法:

  • app/design/frontend/default/yourtheme/template/customer/form/register.phtml
  • app/design/frontend/default/yourtheme/template/customer/form/efor.phtml
  • 应用程序/代码/核心/mage/customer/model/entity/setup.php
  • app/code/core/mage/customer/etc/config.xml
  • App/Code/core/mage/customer/Controllers/counterncontroller.php

非常感谢

有帮助吗?

解决方案

您需要创建自己的模块。 切勿在 app/code/core/ 文件夹. 。如果要在Magento中添加功能,则需要 改写 基础类。

艾伦·斯托姆(Alan Storm)有很好的教程:

如何在Magento中创建一个简单的“ Hello World”模块?

重写控制器(AccountController 在您的情况下),在创建自己的模块之后,您可以关注 这个 教程。

配置布局

在你的 app/code/local/MyCompany/Module/etc/config.xml:

<?xml version="1.0"?>
<config>
    <frontend>
        <layout>
            <updates>
                <mydesign>
                    <file>myfile.xml</file>
                </mydesign>
            </updates>
        </layout>
(...)

那么您可以更新您的布局 app/design/frontend/default/mydesign/layout/myfile.xml.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top