Magento 1.6 - Adding Custom Fields for Registration Page

后端 未结 2 527
后悔当初
后悔当初 2021-01-24 23:51

I want to modify the registration page to add custom fields which would potentially include

  • Address Details

    • Address Line 1
    • Address Line 2
相关标签:
2条回答
  • 2021-01-25 00:05

    There are a ton of extensions to let this happen. My philosophy is to start looking at extensions before trying to code anything in magento. Is especially helpful when an upgrade breaks something; they'll usually fix upgrade problems that clearly affect their own extensions for free.

    To elaborate, I hand rolled some code in the contact form to add google re-capcha as well as to have customers select from existing product attributes (vehicle year, make, model). I was eventually able to figure out how to have these reflect in the emails we get from the contact form, however, there is no database persistence, which is the proper solution. Further, mucking about in the code quickly and easily breaks Magento in unexpected and surprising ways, hence why my normal Magento reply on here is to strongly urge people to buy extensions. If you're asking the kind of questions like I would ask, you don't know enough to make a professional extension... buy a few proper extensions, analyze them, spend lots of time trying to figure it out.

    Any more there are plenty of extensions competing to do the same tasks, so there should be something already working to do what you want.

    0 讨论(0)
  • 2021-01-25 00:27

    Take a look at the customer_setup scripts for reference. For example:

    Mage/Customer/sql/customer_setup/mysql4-upgrade-1.4.0.0.0-1.4.0.0.1.php
    

    This file has an example of how to assign attributes to the customer address form (bottom of file):

    Mage/Customer/sql/customer_setup/mysql4-data-upgrade-1.4.0.0.13-1.4.0.0.14.php
    

    Best practices would be to create a new module with an install script, and put your code in there to add the custom attributes.

    The customer model is an EAV model. EAV is a complicated subject in Magento. A good exercise would be to read up on creating a EAV module -- to understand the basics -- and then come back to adding custom attributes.

    Enterprise allows you to add customer attributes via the admin panel, but unfortunately it's more of a pain for CE.

    That should get you started. Hope this helps.

    0 讨论(0)
提交回复
热议问题