Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/lua/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Magento EAV:什么是';来源';设置用于什么?_Magento_Entity Attribute Value - Fatal编程技术网

Magento EAV:什么是';来源';设置用于什么?

Magento EAV:什么是';来源';设置用于什么?,magento,entity-attribute-value,Magento,Entity Attribute Value,我很好奇这是用来干什么的?我为使用实体脚本添加的自定义属性定义了以下源模型,但我不知道如何使用源属性。也许我可以把它用作表单小部件?我添加的属性是exportStatus到客户eav <?php class Company_Customer_Model_Customer_Attribute_Source_ExportStatus extends Mage_Eav_Model_Entity_Attribute_Source_Abstract { public functio

我很好奇这是用来干什么的?我为使用实体脚本添加的自定义属性定义了以下源模型,但我不知道如何使用源属性。也许我可以把它用作表单小部件?我添加的属性是exportStatus到客户eav

<?php

class Company_Customer_Model_Customer_Attribute_Source_ExportStatus
    extends Mage_Eav_Model_Entity_Attribute_Source_Abstract
{
    public function getAllOptions()
    {
        if (!$this->_options) {
            $this->_options = array(
                array(
                    'value' => '0',
                    'label' => 'Pending Export',
                ),
                array(
                    'value' => '1',
                    'label' => 'Exported to Mainframe',
                ),
                array(
                    'value' => '2',
                    'label' => 'Acknowledged by Mainframe',
                )
            );
        }
        return $this->_options;
    }
}

它允许您创建下拉菜单

见本文:


特别是附录A:下拉选项它允许您创建下拉菜单

见本文:


特别是附录A:下拉选项

嗯。我以为会发生某种自动控制的事情,但看起来我只是将值设置为getAllOptions()嗯。我以为会发生某种自动控制的事情,但看起来我只是将值设置为getAllOptions()
<?php

class Company_Customer_Model_Resource_Eav_Mysql4_Setup extends Mage_Eav_Model_Entity_Setup
{
    public function getDefaultEntities()
    {
        return array(
            'customer' => array(
                'entity_model'          =>'customer/customer',
                'attribute_model'       => 'customer/attribute',
                'table'                 => 'customer/entity',
                'additional_attribute_table' => 'customer/eav_attribute',
                'entity_attribute_collection' => 'customer/attribute_collection',
                'attributes' => array(
                    'export_status' => array(
                        //'group'             => 'Group/Tab',
                        'label'             => 'Customer Export Status',
                        'type'              => 'int',
                        'input'             => 'select',
                        'default'           => '0',
                        'class'             => '',
                        'backend'           => '',
                        'frontend'          => '',
                        'source'            => 'company_customer/customer_attribute_source_exportStatus',
                        'global'            => 2,  //global scope
                        'visible'           => true,
                        'required'          => false,
                        'user_defined'      => false,
                        'searchable'        => false,
                        'filterable'        => false,
                        'comparable'        => false,
                        'visible_on_front'  => false,
                        'visible_in_advanced_search' => false,
                        'unique'            => false
                    )


               )
           )

      );
    }
}