1
votes

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

  • Address Details

    • Address Line 1
    • Address Line 2
    • Suburb
    • Postcode
    • Country
    • State
  • Company Details

    • Name, Tradingname
    • ABN, contact details

I've been reading up on how to add custom fields, but I am having no success what-so-ever, I just get stumped on the whole thing. I'm just trying to learn the system

Any help would be greatly appreciated

Cheers

2
I can tell theres not much love for Magento :P - DdD
Dimitri, no, there is love, we are all too busy fixing Magento to spend more time here. :) Like this guy's chart explains: goo.gl/zgjjX - Chris K
I passed it on in the end lol didn't have time to spend learning a platform that I'll hopefully never have to touch again. Atleast going through the Magento code gave me a fair few good ideas - DdD

2 Answers

2
votes

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.

1
votes

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.