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

Help adding fields(attributes) to the acount information tab
 
platinumtackle
Member
 
Total Posts:  40
Joined:  2008-09-30
 

So I followed the instructions at http://www.magentocommerce.com/wiki/custom_account/registration_fields and everything works great except I can not save the changes to the fields on the account information page.

Here is my config.xml under local/Platinumtackle/Customer/etc/

<config>
    <
modules>
        <
Platinumtackle_Customer>
            <
version>1.0.0</version>
        </
Platinumtackle_Customer>
    </
modules>
    <global>
        <
fieldsets>
            <
customer_account>
                <
prefix><create>1</create><update>1</update><name>1</name></prefix>
                <
firstname><create>1</create><update>1</update><name>1</name></firstname>
                <
middlename><create>1</create><update>1</update><name>1</name></middlename>
                <
lastname><create>1</create><update>1</update><name>1</name></lastname>
                <
suffix><create>1</create><update>1</update><name>1</name></suffix>
                <
email><create>1</create><update>1</update></email>
                <
password><create>1</create></password>
                <
confirmation><create>1</create></confirmation>
                <
dob><create>1</create><update>1</update></dob>
                <
taxvat><create>1</create><update>1</update></taxvat>
                <
fishing_report_rss_url><create>1</create><update>1</update></fishing_report_rss_url>
                <
fishing_report><create>1</create><update>1</update></fishing_report>
                <
website_url><create>1</create><update>1</update></website_url>
            </
customer_account>
        </
fieldsets>
        <
models>
            <
customer_entity>
                <
rewrite>
                    <
setup>Platinumtackle_Customer_Model_Entity_Setup</setup>
                </
rewrite>
            </
customer_entity>
        </
models>
        <
resources>
            <
customer_setup>
                <
rewrite>
                    <
setup>Platinumtackle_Customer_Model_Entity_Setup</setup>
                </
rewrite>
            </
customer_setup>
        </
resources>
    </global>
</
config>

I added the attributes to the database and added the fields, but when I enter something in the fields and press save it does not save.

I also added the app/etc/moules/Platinumtackle_Customer.xml with the following values

<?xml version="1.0" encoding="UTF-8"?>
<config>
  <
modules>
    <
Platinumtackle_Customer>
      <
codePool>local</codePool>
      <
active>true</active>
    </
Platinumtackle_Customer>>
  </
modules>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
platinumtackle
Member
 
Total Posts:  40
Joined:  2008-09-30
 

Here is the setup.php file I extended.

class Mage_Customer_Model_Entity_Setup extends Mage_Eav_Model_Entity_Setup
{

    
public function getDefaultEntities()
    
{
    }
}
 
Magento Community Magento Community
Magento Community
Magento Community
 
phlux0r
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-09
Auckland, New Zealand
 

ooop duplicate - deleted

 
Magento Community Magento Community
Magento Community
Magento Community
 
phlux0r
Member
 
Avatar
Total Posts:  73
Joined:  2008-03-09
Auckland, New Zealand
 

Have you made sure your new form fields have the same name as your database fields?

Also, that Setup.php file doesn’t look like it’s extended. In my case, I have:

class Company_Customer_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup 
{

    
public function getDefaultEntities()
    
{
        
return array(
            
'customer' => array(
                
'entity_model'          =>'customer/customer',
                
'table'                 => 'customer/entity',
                
'increment_model'       => 'eav/entity_increment_numeric',
                
'increment_per_store'   => false,
                
'attributes' => array(


                    
'website_id' => array(
                        
'type'          => 'static',
                        
'label'         => 'Associate to Website',
                        
'input'         => 'select',
                        
'source'        => 'customer/customer_attribute_source_website',
                        
'backend'       => 'customer/customer_attribute_backend_website',
                        
'sort_order'    => 10,
                    ),
                    
'store_id' => array(
                        
'type'          => 'static',
                        
'label'         => 'Create In',
                        
'input'         => 'select',
                        
'source'        => 'customer/customer_attribute_source_store',
                        
'backend'       => 'customer/customer_attribute_backend_store',
                        
'visible'       => false,
                        
'sort_order'    => 20,
                    ),
                    
'created_in' => array(
                        
'type'          => 'varchar',
                        
'label'         => 'Created From',
                        
'sort_order'    => 30,
                    ),
                    
'prefix' => array(
                        
'label'         => 'Prefix',
                        
'required'      => false,
                        
'sort_order'    => 37,
                    ),
                    
'firstname' => array(
                        
'label'         => 'First Name',
                        
'sort_order'    => 40,
                    ),
                    
'middlename' => array(
                        
'label'         => 'Middle Name/Initial',
                        
'required'      => false,
                        
'sort_order'    => 43,
                    ),
                    
'lastname' => array(
                        
'label'         => 'Last Name',
                        
'sort_order'    => 50,
                    ),
 .... 
etc as per WIKI post
 
Magento Community Magento Community
Magento Community
Magento Community
 
platinumtackle
Member
 
Total Posts:  40
Joined:  2008-09-30
 

class Platinumtackle_Customer_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup
{

    
public function getDefaultEntities()
    
{
        
return array(
            
'customer' => array(
                
'entity_model'          =>'customer/customer',
                
'table'                 => 'customer/entity',
                
'increment_model'       => 'eav/entity_increment_numeric',
                
'increment_per_store'   => false,
                
'attributes' => array(
//                    'entity_id'         => array('type'=>'static'),
//                    'entity_type_id'    => array('type'=>'static'),
//                    'attribute_set_id'  => array('type'=>'static'),
//                    'increment_id'      => array('type'=>'static'),
//                    'created_at'        => array('type'=>'static'),
//                    'updated_at'        => array('type'=>'static'),
//                    'is_active'         => array('type'=>'static'),

//At the very end of this array I have

                    
'fishing_report_rss_url' => array(
                        
'label'        => 'Fishing Report RSS URL',
                        
'visible' => true,
                        
'required'      => false,
                        
'sort_order'    => 90,
                    ),
                    
'webpage_url' => array(
                        
'label'         => 'Webpage URL',
                        
'visible' => true,
                        
'required'      => false,
                        
'sort_order'    => 91,
                    ),
                    
'fishing_report' => array(
                        
'label'         => 'Fishing Report',
                        
'visible' => true,
                        
'required'      => false,
                        
'sort_order'    => 92,
                    ),

in my edit.phtml I have

<fieldset class="group-select">
    <
h4 class="legend"><?php echo $this->__('Guide Information'?></h4>
    <
ul>
        <
li>
            <
div class="input-box">
            <
label for="webpage_url">Guide Website URL</label><br />
            <
input type="text" style="width=100px;"name="webpage_url" id="webpage_url" value="<?php echo $this->htmlEscape($this->getCustomer()->getWebsiteUrl()) ?>" title="Guide Website URL" class=" validate-clean-url input-text" />
            </
div>
        </
li>
        <
li>
            <
div class="input-box">
            <
label for="fishing_report_rss_url">Fishing Report RSS Feed URL</label><br />
            <
input type="text" style="width=100px;" name="fishing_report_rss_url" id="fishing_report_rss_url" value="<?php echo $this->htmlEscape($this->getCustomer()->getFishingReportRssUrl()) ?>" title="Fishing Report RSS Feed URL" class="validate-clean-url input-text" />
            </
div>
        </
li>
        <
li>
            <
div class="input-box">
            <
label for="fishing_report">Fishing Report</label><br />
            <
textarea style="width:650px;height:160px;overflow:auto;" name="fishing_report" id="fishing_report" title="Fishing Report" class="textarea"><?php echo $this->htmlEscape($this->getCustomer()->getFishingReport()) ?></textarea>
            </
div>        
        </
li>
<?php endif; ?>
</fieldset>

I made sure the setup was extended correctly any other ideas.  I also fixed the config o use webpage_url instead of website_url

 
Magento Community Magento Community
Magento Community
Magento Community
 
platinumtackle
Member
 
Total Posts:  40
Joined:  2008-09-30
 

Should I have the new fields in the second array instead of the first?  Within the ‘customer_address’=>array( ) instead.

 
Magento Community Magento Community
Magento Community
Magento Community
 
LeeSaferite
Guru
 
Avatar
Total Posts:  322
Joined:  2007-08-31
Lake City, FL
 

I reccommend NOT using the Setup class to contain your custom attributes.  Instead, use the MySQL install script.  The reason is, you get versioning support with the MySQL script but not with the Setup class.

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