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

Customer attribute value is not saving in the frontend. 
 
dolmen1232
Jr. Member
 
Total Posts:  2
Joined:  2012-07-22
 

I have added a custom attribute to customer address(to select address type commercial or residential) using Hwg Attribute manager extension(Manage Category, Customer and Customer Address Attributes). It is working in the back end. But the problem is not working for the front end. My attribute name is billingaddresstype.

this is the code i used in the front end customer address edit.phtml

<li class="fields">            
                    <
label for="billingaddresstype" class="required"><em>*</em><?php echo $this->__('Address Type'?></label>
                    <
div class="input-box">    
                        <
select name="billingaddresstype" id="billingaddresstype">
                        <
option value selected="selected"></option>
                            
<?php $collection Mage::getResourceModel('eav/entity_attribute_option_collection');                            
                                 
$collection->setAttributeFilter(184);
                                 
$collection->setStoreFilter();
                                 
$collection->load();
                                
$options $collection->toOptionArray();
                                 foreach (
$options as $option{
                                     
echo "<option value='".$option['value']."'>".$option['label']."</option>";               
                                 
}
                            ?>
                        
</select>
                    </
div>
                </
li>

it shows the address type dropdown with correct values, but it doesn’t save value to the database. I checked in the customer address controller, address form doesn’t post the dropdown value.

Can some one give me a help with this.  Thank you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Siggi_Schmitz
Enthusiast
 
Avatar
Total Posts:  811
Joined:  2011-07-03
 

I think that the value will not be save, you have to edit the code to save this attribute manually.

But: The element is there and when the form is saved, the element has to exist in the POST or GET parameters...are you sure that the POST or GET Data from the element don`t come to the controller?
Maybe you are not in the correct method?

And sorry for my english, my brain is overloaded actually^^

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

Hi there!

As an alternative variant you may also try this module: http://amasty.com/customer-attributes.html. It allows you easily place fields on registration page to know age, preferences and interests, receive documents and all other information you may need.

With the customer attributes tool you’ll be able to:

- Add unlimited number of fields to registration page
- Effectively manage the collected data in admin panel
- Find out personality and behavior of your clients
- Conduct an effective customer segmentation

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageBright
Sr. Member
 
Avatar
Total Posts:  100
Joined:  2011-11-21
 

Hi
This is good extension May be someone help this

http://www.magentocommerce.com/magento-connect/attribute-manager-1.html

http://www.magebright.com/attribute-manager.html

Thank you

 
Magento Community Magento Community
Magento Community
Magento Community
 
Krish_Inc
Member
 
Total Posts:  42
Joined:  2014-02-03
India
 

This is the code i used to get my custom attribute to the front end. and it is saving data correctly.

<li class=\"fields\">
                
<?php 
                    $attribute 
Mage::getModel(\'eav/config\')->getAttribute(\'customer_address\',\'adtype\');
                
?>
                
<label for=\"adtype\" class=\"<?php if($attribute->getIsRequired() == true){?>required<?php } ?>\"><?php if($attribute->getIsRequired() == true){?><em>*</em><?php } ?><?php echo $this->__(\'Address Type\'?></label>
                <
div class=\"input-box\">
                    <
select name=\"adtype\" id=\"adtype\" class=\"<?php if($attribute->getIsRequired() == true){?>required-entry<?php } ?>\">
                        
<?php
                             $options 
$attribute->getSource()->getAllOptions();                                
                             foreach(
$options as $option){
                        ?>
                            
<option value=\'<?php echo $option[\'value\']?>\' <?php if($this->getCustomer()->getAdtype() == $option[\'value\'])echo \'selected=\"selected\"\';}?>><?php echo $this->__($option[\'label\'])?></option>
                        
<?php } ?>
                    
</select>
                </
div>
            </
li>

\’adtype\’ is my attribute code. field name and id must be the attribute code.

Krish Inc
http://www.krishinc.com/

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