customer_address默认值中的自定义字段

时间:2013-11-28 15:26:41

标签: php magento

我已经为customer和customer_address定义了一个lastname2属性,它在所有表单中都能正确显示,但是当我创建一个新地址时,它不会“预先填充”客户的值。

关于如何做的任何线索?

我的字段的定义:

$entityAttributes = array(
        'customer'=>array(
            'lastname2' =>  array(
                'store_label'=>'Apellido Materno',
                'label' => 'Apellido Materno',
                'input' => 'text',
                'type'  => 'varchar',
                //System =  False and visible true = Show in 'customer_account_create', 'customer_account_edit', 'checkout_register'
                'system'=>true,
                'visible'=>true, //Watch out!! Only visible fields get processed by the form controllers!!!
                'user_defined'=>false,
                'used_in_forms' => array('adminhtml_customer', 'customer_account_edit', 'checkout_register','customer_account_create'),
                'required' => 0,
                'position' =>69
            ),),
'customer_address'=> array(
            'lastname2' =>  array(
                'store_label'=>'Apellido Materno',
                'label' => 'Apellido Materno',
                'input' => 'text',
                'type'  => 'varchar',
                //System =  False and visible true = Show in 'customer_account_create', 'customer_account_edit', 'checkout_register'
                'system'=>false,
                'visible'=>true, //Watch out!! Only visible fields get processed by the form controllers!!!
                'user_defined'=>false,
                'used_in_forms' => array('customer_account_create','customer_register_address','customer_address_edit','adminhtml_customer_address','adminhtml_customer'),
                'required' => 0,
                'position' =>49
            ),
        ),
    );
# Install Attributes
    foreach($entityAttributes as $entity=>$attributes)
    {
        foreach($attributes as $attribute_code=>$definition)
        {
            $installer->addAttribute($entity, $attribute_code,  $definition); 

            /**
            * @var Mage_Eav_Model_Config
            */
            Mage::getSingleton('eav/config')
            ->getAttribute($entity, $attribute_code)
            ->setData('used_in_forms',$definition['used_in_forms'])
            ->save();
        }
    }

我的config.xml(相关摘录,完整版本为here

<global>
<!-- [...] -->
        <fieldsets>
            <!-- @see http://www.excellencemagentoblog.com/customer-registration-fields-magento1-6 -->
            <customer_account>
                <lastname2>
                    <create>1</create>
                    <update>1</update>
                    <name>1</name>
                    <to_quote>customer_lastname2</to_quote>
                    <to_customer_address>lastname2</to_customer_address>
                    <to_customer_address>customer_lastname2</to_customer_address>
                </lastname2>
            </customer_account>      
            <customer_address>
                <lastname2>
                    <to_quote_address>*</to_quote_address>
                </lastname2>
            </customer_address>
        </fieldsets> 
<!-- [...] -->
</global>

0 个答案:

没有答案