Magento - Clean custom Account/Registration Fields
I followed this tutorial to add fields in the registration form of a customer under Magento, I succeed to run the example, but I know that It开发者_开发知识库 is not clean, for upates later...
What' the best way to rewrite all the files used in the tutorial, in a clean way :
- app/design/frontend/default/yourtheme/template/customer/form/register.phtml
- app/design/frontend/default/yourtheme/template/customer/form/edit.phtml
- app/code/core/Mage/Customer/Model/Entity/Setup.php
- app/code/core/Mage/Customer/etc/config.xml
- app/code/core/Mage/Customer/controllers/AccountController.php
Thanks a lot
You need to create your own module. Never edit files in app/code/core/
folder. If you want to add functionality to Magento, you need to rewrite the base classes.
Alan Storm has good tutorials to follow:
How to create a simple 'Hello World' module in Magento?
To rewrite a controller (AccountController
in your case), and after you create you own module, you can follow this tutorial.
Configure the Layout
In your app/code/local/MyCompany/Module/etc/config.xml
:
<?xml version="1.0"?>
<config>
<frontend>
<layout>
<updates>
<mydesign>
<file>myfile.xml</file>
</mydesign>
</updates>
</layout>
(...)
Then you could update your layout in app/design/frontend/default/mydesign/layout/myfile.xml
.
精彩评论