New Member Registration field for Magento1.5 (GO)

Source: Internet
Author: User

The first step is to create a new module and create a new file in the app/etc/modules/directory shuishui_customer.xml

<config>    <modules>        <Shuishui_Customer>            <active>true</active >            <codePool>community</codePool>        </Shuishui_Customer>    </modules></ Config>

The second step, the new config configuration file for this module, is located in app/code/community/shuishui/customer/etc/config.xml

<?xml version="1.0"?><config> <modules> <Shuishui_Customer> <version>0.1.0</version> </Shuishui_Customer> </modules> <Global> <fieldsets> <customer_account> <mobile><create>1</create><update>1</update></mobile> </customer_account> </fieldsets> <models> &lt ; Shuishui_customer> <class>shuishui_customer_model</class> </Shuishui_Customer> </models> class>shuishui_customer_helper</class> </Shuishui_Customer> class>shuishui_customer_model_entity_setup</class> </setup> </customerattribute_setup> </resources> </Global> </config>

Step three, create a new Model class, inherit from the Mage_customer_model_entity_setup class, add a new field to the class, and position it in app/code/Community/shuishui/ customer/model/entity/setup.php

class Fanxiang_customer_model_entity_setup extends Mage_customer_model_entity_setup
'Created_at'=Array ('type'='Static',                        'label'='Created at',                        'Visible'=false,                        'Required'=false,                        'input'='Date',                    ),                    'Mobile'=Array ('type'='Static',                        'label'='Mobile',                        'Visible'=true,                        'Required'=false,                        'Sort_order'= the,                    ),                ),            ),            'customer_address'=Array ('Entity_model'='customer/customer_address',                'Table'='customer/address_entity',                'additional_attribute_table'='Customer/eav_attribute',                'entity_attribute_collection'='customer/address_attribute_collection',

Fourth step, add a Database installation script file, location in app/code/community/shuishui/customer/sql/customerattribute_setup/ mysql4-install-0.1.0.php

$installer = $ This; $installer-Startsetup (); $installer->addattribute ('Customer','Mobile', Array ('label'='Mobile',      'Visible'=1,      'Required'=0,      'position'=1,      'Sort_order'= the,    )); $installer-Endsetup (); $customerattribute= Mage::getmodel ('Customer/attribute')->loadbycode ('Customer','Mobile'); $forms= Array ('Customer_account_edit','customer_account_create','Adminhtml_customer','Checkout_register'); $customerattribute->setdata ('used_in_forms', $forms); $customerattribute->save ();

Fifth step, add a new form item in the template file of the foreground registration page, in template\customer\form\register.phtml

<li> <label for="Mobile" class="Required"><em>*</em><?php echo $ This-&GT;__ ('Mobile')?></label> <divclass="Input-box"> <input type="text"Name="Mobile"Id="Mobile"Value=""title="<?php Echo $this->__ (' mobile ')?>" class="Input-text required-entry"/> </div> </li>

Foreground display effect

Background Member Management page effect



ps:1.4 version is also available

See Original: http://mydons.com/how-to-add-custom-fields-to-customer-registration-and-account-page-in-magento-1-5/

New Member Registration field for Magento1.5 (GO)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.