gpt4 book ai didi

php - 我可以在 magento 中使用我的属性脚本设置默认商店 View 标签吗

转载 作者:塔克拉玛干 更新时间:2023-11-03 06:06:09 26 4
gpt4 key购买 nike

我正在使用一个模块在客户模型上创建一个新属性。有谁知道如何使用我的设置脚本设置默认商店 View ?

admin screenshot

我当前的脚本:

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

最佳答案

据我所知,不可能直接在 addAttribute() 调用中执行此操作。但是您可以通过以下方式在保存属性后设置商店标签:

$attributeId = $this->getAttributeId('customer', 'dob_month');
$attribute = Mage::getModel('eav/entity_attribute')->load($attributeId);
$attribute->setStoreLabels(array(store_id => 'Store label'))
->save();

关于php - 我可以在 magento 中使用我的属性脚本设置默认商店 View 标签吗,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12483431/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com