douchongbang6011 2013-11-28 15:26
浏览 27

customer_address默认值中的自定义字段

I have defined a lastname2 attribute for customer and customer_address, it shows up correctly in all forms, but when I'm creating a new address, its does not get 'prefilled' with the customer's value.

Any clues on how to do it?

The definition of my fields:

$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();
        }
    }

My config.xml (relevant extracts, the full version is 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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 如何在炒股软件中,爬到我想看的日k线
    • ¥15 51单片机中C语言怎么做到下面类似的功能的函数(相关搜索:c语言)
    • ¥15 seatunnel 怎么配置Elasticsearch
    • ¥15 PSCAD安装问题 ERROR: Visual Studio 2013, 2015, 2017 or 2019 is not found in the system.
    • ¥15 (标签-MATLAB|关键词-多址)
    • ¥15 关于#MATLAB#的问题,如何解决?(相关搜索:信噪比,系统容量)
    • ¥500 52810做蓝牙接受端
    • ¥15 基于PLC的三轴机械手程序
    • ¥15 多址通信方式的抗噪声性能和系统容量对比
    • ¥15 winform的chart曲线生成时有凸起