감사 읽고 ... 아니에요 : (모듈을 통해) 알고 필드를 만드는 것입니다 다음과 같이 당신이 시도하고있는 것 같아 addAttribute()
, _prepareValues($attr)
메서드를 사용하면 $data
에 저장되는 특정 값만 허용 할 수 있습니다.
모양의 @ 응용 프로그램/코드/코어/마법사/EAV/모델/법인/Setup.php가
public function addAttribute($entityTypeId, $code, array $attr)
{
$entityTypeId = $this->getEntityTypeId($entityTypeId);
$data = array_merge(
array(
'entity_type_id' => $entityTypeId,
'attribute_code' => $code
),
$this->_prepareValues($attr);
);
.....
if ($attributeId) {
$this->updateAttribute($entityTypeId, $attributeId, $data, null, $sortOrder);
} else {
$this->_insertAttribute($data);
}
.......
}
protected function _prepareValues($attr)
{
$data = array(
'backend_model' => $this->_getValue($attr, 'backend'),
'backend_type' => $this->_getValue($attr, 'type', 'varchar'),
'backend_table' => $this->_getValue($attr, 'table'),
'frontend_model' => $this->_getValue($attr, 'frontend'),
'frontend_input' => $this->_getValue($attr, 'input', 'text'),
'frontend_label' => $this->_getValue($attr, 'label'),
'frontend_class' => $this->_getValue($attr, 'frontend_class'),
'source_model' => $this->_getValue($attr, 'source'),
'is_required' => $this->_getValue($attr, 'required', 1),
'is_user_defined' => $this->_getValue($attr, 'user_defined', 0),
'default_value' => $this->_getValue($attr, 'default'),
'is_unique' => $this->_getValue($attr, 'unique', 0),
'note' => $this->_getValue($attr, 'note'),
'is_global' => $this->_getValue($attr, 'global',
Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL
),
);
return $data;
}
죄송합니다. –