Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Page 1 of 2
Address Fields At Registration? 
 
Auriferous
Jr. Member
 
Total Posts:  26
Joined:  2008-05-22
 

Is there an easy way to add an address at the time of registration? I have added some custom fields and in the process I found that in “register.phtml” there is a section containing the address fields but conditional on this statement:
<?php if($this->getShowAddressFields()): ?>

Is there a setting in the admin panel or elsewhere that would open these up?

In order for us to validate our wholesale customers we need to collect this data at registration so that we can allow them “Wholesale Access” to the site.

Also, What file could I insert some script that would capture the form values at the time of saving the info.. I would like to insert some triggers to run some custom scripts..

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageAustralia
Member
 
Total Posts:  37
Joined:  2008-08-23
Sydney, Australia
 

Also looking for the same. I have searched the DB fields and the admin area looking for this.

I am about to follow this post: http://www.magentocommerce.com/boards/viewthread/9620/ to achieve what I wanted but prefer to work within magento rather than hack away at it.

$# grep -lR “getShowAddressFields” *

for the root magento directory shows that:

app/design/frontend/default/default/template/customer/form/register.phtml

is the only file with this function, so it looks to me as though it´s something that´s planned for a future version but not yet implemented.

Looks like we have to follow the post above.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mich81.com
Member
 
Total Posts:  55
Joined:  2008-04-14
 

I’m interested in it too.
How can I add address information during account registration?
I want people to insert their address in order to have alway this information, not only for people who proceed to order.
If I insert custom field when they place an order they will insert a new address.

Thanks in advance guys.

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageAustralia
Member
 
Total Posts:  37
Joined:  2008-08-23
Sydney, Australia
 

Hey,

This is quite easy once you know how.. as long as you have a 1.1 version onwards.

The getShowAddressFields is function is not yet implemented in versions: 1.1.1-1.1.4 so we need to comment it out in our code:

In app/design/frontend/default/<yourstore>/template/customer/form/register.html

Change Line 61
<?php if($this->getShowAddressFields()): ?>

to

<?php // if($this->getShowAddressFields()): ?>

Change Line 115
<?php endif; ?>
to
<?php //endif; ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sowmya
Jr. Member
 
Total Posts:  15
Joined:  2009-06-23
 

Even i am searching for this.. I am using version 1.3.2…
Is their any option to enable in admin side.

 
Magento Community Magento Community
Magento Community
Magento Community
 
andrewherman
Jr. Member
 
Total Posts:  19
Joined:  2009-06-14
 

*double post*

 
Magento Community Magento Community
Magento Community
Magento Community
 
andrewherman
Jr. Member
 
Total Posts:  19
Joined:  2009-06-14
 

As of 1.3.2.1, commenting out the ‘if’ and ‘endif’ seems to be incomplete by itself, as the ‘state/province’ field them disappears.
A proper fix is posted here:
http://www.magentocommerce.com/boards/viewthread/43354/

 
Magento Community Magento Community
Magento Community
Magento Community
 
j2tdesign
Sr. Member
 
Avatar
Total Posts:  208
Joined:  2008-07-16
France
 

I think that the easiest way is to put

<?php $this->setShowAddressFields(true)?>
Right before your if condition
 
Magento Community Magento Community
Magento Community
Magento Community
 
M$ Guru
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2009-10-06
Nor Cal
 

This worked for me. From http://www.magentocommerce.com/boards/viewthread/43354/#t141157

in the “register.phtml” delete or comment out the line:

<?php if($this->getShowAddressFields()): ?>

and also <?php endif; ?>

then go to .....template/customer/address/edit.phtml

and copy the javascript snippet at the end of the file, because it changed, or use this and overwrite the script at the end of register.phtml

New script from edit.phtml:

<script type="text/javascript\">
var dataForm = new VarienForm(’form-validate’, true);
new RegionUpdater(’country’, ‘region’, ‘region_id’, <?php echo $this->helper('directory')->getRegionJson() ?>);
</script>

 
Magento Community Magento Community
Magento Community
Magento Community
 
HyperBallad
Member
 
Avatar
Total Posts:  57
Joined:  2008-06-27
Montreal, QC
 
M$ Guru - 13 October 2009 08:22 AM

This worked for me. From http://www.magentocommerce.com/boards/viewthread/43354/#t141157

in the “register.phtml” delete or comment out the line:

<?php if($this->getShowAddressFields()): ?>

and also <?php endif; ?>

then go to .....template/customer/address/edit.phtml

and copy the javascript snippet at the end of the file, because it changed, or use this and overwrite the script at the end of register.phtml

New script from edit.phtml:

<script type="text/javascript\">
var dataForm = new VarienForm(’form-validate’, true);
new RegionUpdater(’country’, ‘region’, ‘region_id’, <?php echo $this->helper('directory')->getRegionJson() ?>);
</script>

No need to add any javascript, there is no bug on this page.
Just don’t forget to remove or comment line 148 and 150 (<?php if(!$this->getShowAddressFields()): ?>)

 
Magento Community Magento Community
Magento Community
Magento Community
 
M$ Guru
Jr. Member
 
Avatar
Total Posts:  14
Joined:  2009-10-06
Nor Cal
 
HyperBallad - 13 October 2009 10:57 AM

M$ Guru - 13 October 2009 08:22 AM
This worked for me. From http://www.magentocommerce.com/boards/viewthread/43354/#t141157

in the “register.phtml” delete or comment out the line:

<?php if($this->getShowAddressFields()): ?>

and also <?php endif; ?>

then go to .....template/customer/address/edit.phtml

and copy the javascript snippet at the end of the file, because it changed, or use this and overwrite the script at the end of register.phtml

New script from edit.phtml:

<script type="text/javascript\">
var dataForm = new VarienForm(’form-validate’, true);
new RegionUpdater(’country’, ‘region’, ‘region_id’, <?php echo $this->helper('directory')->getRegionJson() ?>);
</script>

No need to add any javascript, there is no bug on this page.
Just don’t forget to remove or comment line 148 and 150 (<?php if(!$this->getShowAddressFields()): ?>)

Right you are. I needed this fix again, so I figured I’d throw in a bit more detail.

Location: app/design/frontend/default/[your-theme]/template/customer/form/register.phtml

Line 69: <?php if($this->getShowAddressFields()): ?>
Line 123: <?php endif; ?>

 
Magento Community Magento Community
Magento Community
Magento Community
 
DDK
Jr. Member
 
Total Posts:  3
Joined:  2008-12-19
 

This is good.

Right now the fields are viewable on all stores though, retail and wholesale.

Is there a way to show those extra fields to wholesale customers only.

Thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rimamkt
Jr. Member
 
Total Posts:  21
Joined:  2009-10-05
 

@DDK

Yes, but you will need to create new design and skin folders and point them to the correct store. Since your Default configuration points to only one app/design and skin/ set of folders (mainly default/), you’ll have to make a different set of folders in the app/frontend/default/[new-folder] and skin/frontend/default/[new-folder]. Then in the System-Configuration, make sure you have the right website selected, then change the folders in the [Wholesale]-System-Configuration-Design. hope this helps!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Amasty
Mentor
 
Avatar
Total Posts:  3988
Joined:  2009-11-10
 

I think the easiest way to add new fields to the registration form is to install Customer Attributes extension. It gives the ability to easily add any fields you like, show them in admin area, allows to filter by them. Compatible with both 1.3 and 1.4 versions. 

Please feel free to pm me if you have any questions regarding the addon.

 
Magento Community Magento Community
Magento Community
Magento Community
 
scato
Jr. Member
 
Total Posts:  1
Joined:  2010-03-04
 

There’s also another way to fix this. Mage_Checkout_MultishippingController::registerAction (v1.4.0.1) contains the following code:

if ($registerForm $this->getLayout()->getBlock('customer_form_register')) {
            $registerForm
->setShowAddressFields(true)
                ->
setBackUrl($this->_getHelper()->getMSLoginUrl())
                ->
setSuccessUrl($this->_getHelper()->getMSShippingAddressSavedUrl())
                ->
setErrorUrl($this->_getHelper()->getCurrentUrl());
        
}

It looks like getShowAddressFields and setShowAddressFields are a magic getter and setter. So the logical choice would be to put part of this code in Mage_Customer_AccountController::createAction…

WRONG!

Magento gives developers the ability to extend modules. This is just a class-loader trick. The class-loader first checks app/code/local, then app/code/core. (See how_to_create_a_local_copy_of_app_code_core_mage.) A more acurate description would be “overloading”.

Only problem: you can’t overload controllers. Best solution: overload the block called “customer_form_register”.

To do this, copy this file:

app/code/core/Mage/Customer/Block/Form/Register.php

to:

app/code/local/Mage/Customer/Block/Form/Register.php

and add this to Mage_Customer_Block_Form_Register::_prepareLayout:

$this->setShowAddressFields(true);

Step 3: make profit

 
Magento Community Magento Community
Magento Community
Magento Community
 
brendanb
Mentor
 
Total Posts:  1093
Joined:  2008-07-16
London, United Kingdom
 

thanks scato,

can confirm this works in 1.4.1

brendan

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 1 of 2