1

I have created custom customer attribute, and it is working (the attribute is registered in DB). When I try to enter data for that attribute nothing happens.

Code for creating attribute:

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Sasha_Customer>
            <version>0.0.1</version>
        </Sasha_Customer>
    </modules>
    <global>
        <fieldsets>
            <customer_account>
                <abn><create>1</create><update>1</update></abn>
            </customer_account>
        </fieldsets>
        <models>
            <sasha_customer>
                <class>Sasha_Customer_Model</class>
            </sasha_customer>
        </models>
        <resources>
            <sasha_customer_setup>
                <setup>
                    <module>Sasha_Customer</module>
                    <class>Sasha_Customer_Model_Entity_Setup</class>
                </setup>
            </sasha_customer_setup>
        </resources>
    </global>
</config>

Model/Entity/Setup.php

<?php

class Sasha_Customer_Model_Entity_Setup extends Mage_Customer_Model_Entity_Setup {}

sql/sasha_customer_setup/mysql4-install-0.0.1.php

<?php

$installer = $this;
$installer->startSetup();

$installer->addAttribute('customer', 'abn', array(
    'label'    => 'ABN',
    'type'     => 'varchar',
    'input'    => 'text',
    'visible'  => true,
    'required' => true,
    'position' => 9999,
    "unique"   => true
));

$installer->endSetup();

And in the account information (edit.phtml) I have this:

<li>
<label for="abn" class="required"><em>*</em><?php echo $this->__('ABN') ?></label>
<div class="input-box">
<input type="text" name="abn" id="abn" value="<?php echo $this->escapeHtml($this->getCustomer()->getAbn()) ?>" title="<?php echo $this->__('ABN') ?>" class="input-text required-entry" />
</div>
</li>

What am I doing wrong?

2
  • I did that, still nothing is happening.
    – Sasha
    Jul 24, 2014 at 16:30
  • Your code and the one in that question are not the same. Did you checked that?
    – mbalparda
    Jul 24, 2014 at 16:32

0

Browse other questions tagged or ask your own question.