magento 添加字段到客户地址并显示在管理面板中?

pjngdqdw  于 2023-02-23  发布在  其他
关注(0)|答案(2)|浏览(129)

我刚刚为客户地址创建了一个属性(lastname2),但是我无法在管理面板的编辑地址字段中显示它。
如下图所示,我设置了used_in_forms,使其包含'adminhtml_customer_address''adminhtml_customer',但字段仍然拒绝显示。
任何帮助都将不胜感激。
这是我的安装程序代码:

<?php
    // update customer address user defined attributes data
    $entityAttributes = array('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'=>true,
                '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' =>69
            ),
 );

# 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();
    }
}
9w11ddsr

9w11ddsr1#

大卫,我会建议你去通过这个不错的职位http://www.excellencemagentoblog.com/magento-adding-custom-field-to-customer-address
我觉得你可能需要改变地址显示格式以及。

qyzbxkaa

qyzbxkaa2#

我刚刚解决了它。这是一个愚蠢的错误。这是一个将system从true改为false的问题。

相关问题