Sco*_*t S 4 php magento entity-attribute-value
我正在使用模块在客户模型上创建新属性.有谁知道如何使用我的设置脚本设置默认商店视图?

我目前的剧本:
$setup = new Mage_Customer_Model_Resource_Setup('customer_setup');
if (! $setup->getAttribute('customer', 'dob_month')) {
$setup->addAttribute('customer', 'dob_month', array(
'label' => 'Month',
'type' => 'varchar',
'input' => 'select',
'source' => 'eav/entity_attribute_source_table',
'required' => true,
'position' => 1,
'option' => array (
'values' => array (
'January',
'February',
'March',
'April',
'May',
'June',
'July',
'August',
'September',
'October',
'November',
'December'
)
)
));
}
Run Code Online (Sandbox Code Playgroud)
据我所知,在addAttribute()通话中不可能直接这样做.但是您可以在下一个方法保存属性后设置商店标签:
$attributeId = $this->getAttributeId('customer', 'dob_month');
$attribute = Mage::getModel('eav/entity_attribute')->load($attributeId);
$attribute->setStoreLabels(array(store_id => 'Store label'))
->save();
Run Code Online (Sandbox Code Playgroud)