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

Remove required Fields for Billing Address in the registration form
 
vmaillot
Jr. Member
 
Total Posts:  19
Joined:  2009-01-05
Montreal
 

Hi!

I’m trying to remove some required fields for the billing address in the registration form.
I’ve found this thread => http://www.magentocommerce.com/boards/viewthread/28618/ dealing with theses fields.

I’ve done all the contrary of what is written :

- switched to 0 all references to any requirement & visibility concerning the fields I wanted to remove.

<country><billing>0</billing><shipping>0</shipping><billing_required>0</billing_required><shipping_required>0</shipping_required></country>

- switched to 0 the “is_required” parameter in the eav_attribute table for all attribute_code I want to remove.

- remove all code blocks concerning these fields from app/design/frontend/default/MyCompany/template/checkout/onepage/billing.phtml
For example :

<div class="input-box">
                <
label for="billing:city"><?php echo $this->__('City'?> <span class="required">*</span></label><br />
                <
input type="text"
                       
title="<?php echo $this->__('City') ?>"
                       
name="billing[city]"
                       
value="<?php echo $this->htmlEscape($this->getAddress()->getCity()) ?>"
                       
class="input-text"
                       
id="billing:city" /></div>

- modified my etc/config.xml =>

<global>
       <
models>
           
[...]
            
<customer> <!-- tried with <saleswithout success -->
                <
rewrite>
                    <
order_address>MyCompany_MyModule_Model_Order_Address</order_address>
                </
rewrite>
            </
customer>
             
[...]
        
</models>

[...]

- created a file app/code/local/MyCompany/MyModule/Model/Order/Address.php

<?php
class MyCompany_MyModule_Model_Order_Address extends Mage_Core_Model_Abstract
{
    
/**
     * Validate address attribute values
     *
     * @return bool
     */
    
public function validate()
    
{
        $errors 
= array();
        
$helper Mage::helper('customer');
        
$this->implodeStreetAddress();

        if (!
Zend_Validate::is($this->getFirstname(), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter first name.');
        
}

        
if (!Zend_Validate::is($this->getLastname(), 'NotEmpty')) {
            $errors[] 
$helper->__('Please enter last name.');
        
}

        
if (empty($errors)) {
            
return true;
        
}
        
return $errors;
    
}

}

As it was not working, I’ve created a complete new app/code/locale/MyCompany/Customer/ module, based on the previous files :
app/code/locale/MyCompany/Customer/etc/config.xml,
app/code/locale/MyCompany/Customer/Model/Order/Address.php,
activate my module in app/etc/modules/MyCompany_Customer.xml

Well ... it’s still not working.
Could someone help me please ?  long face

 
Magento Community Magento Community
Magento Community
Magento Community
 
unfeasible
Sr. Member
 
Avatar
Total Posts:  94
Joined:  2008-03-03
New Zealand
 

http://www.magentocommerce.com/boards/viewthread/19125/

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top