如何将属性添加到管理产品的自定义选项卡
问题描述:
我在管理产品上创建了一个选项卡。通过以下方式。如何将属性添加到管理产品的自定义选项卡
<adminhtml_catalog_product_edit>
<reference name="product_tabs">
<action method="addTab" ifconfig="customoptionspricing/general/enable" ifvalue="1">
<name>customoptionspricing_tab</name>
<block>customoptionspricing/adminhtml_catalog_product_tab</block>
</action>
</reference>
</adminhtml_catalog_product_edit>
标签显示完美,我有一些自定义数据显示在它的phtml文件。
现在我必须在此选项卡的内容中显示产品自定义属性。我不知道如何通过使用这个phtml文件或者其他方式来添加这个。
我尝试添加属性,像这样:
$setup = new Mage_Eav_Model_Entity_Setup('core_setup');
$setup->addAttribute('catalog_product', 'is_cop_product', array(
'group' => 'Custom Options Pricing',
'label' => 'Is Custom Options Pricing (COP) Product',
'type' => 'int',
'input' => 'boolean',
'visible' => true,
'required' => true,
'position' => 1,
'global' => 'Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL',
'note' => "is product a cop product"
));
,但这种方式创建另一个选项卡(新组),有此属性。
所以我需要这个属性被添加到我已经创建的选项卡上。谢谢
答
尝试设置used_in_forms
。
Mage::getSingleton('eav/config')
->getAttribute('catalog_product','is_cop_product')
->setData('used_in_forms', array('customoptionspricing_tab'))
->save();
这对我们在1.8和1.9工作。在我们的情况下,这是一个客户属性,但我不明白为什么它不适用于产品。
您是否找到关于此问题的更多信息?我只使用'addAttribute'来添加一个自定义属性。但我使用了'general'组。现在我正在弄清楚如何为自定义属性更改组,以便它显示在另一个选项卡中。 – Guus 2013-08-26 10:08:15