【发布时间】:2012-12-31 07:47:38
【问题描述】:
我想为我的自定义产品类型添加新的自定义选项卡,如图像“价格 - 尺寸”中所示
我尝试了来自 link-1 和 link-2 的代码,但它在所有产品类型添加/编辑上显示标签
我的问题与this 相同,但想使用编码来完成此操作
mysql4-install-0.1.0.php
$installer = $this;
$installer->startSetup();
$installer->addAttribute('catalog_product', 'limits', array(
'group' => 'Price - Size',
'type' => 'varchar',
'frontend' => '',
'backend' => 'custproduct/entity_attribute_backend_limit',
'label' => 'Limit',
'input' => 'text',
'class' => '',
'source' => '',
'global' => Mage_Catalog_Model_Resource_Eav_Attribute::SCOPE_GLOBAL,
'visible' => true,
'required' => false,
'user_defined' => true,
'default' => '1',
'searchable' => false,
'filterable' => false,
'comparable' => false,
'visible_on_front' => true,
'unique' => false,
'apply_to' => My_Custproduct_Model_Product_Type::TYPE_CustomProduct_PRODUCT, //also try 'custproduct'
'is_configurable' => false
));
$installer->addAttributeGroup('catalog_product', 'Default','Price - Size', 40);
$installer->addAttributeToSet('catalog_product','Default', 'Price - Size', 'limits');
$fieldList = array('price','special_price','special_from_date','special_to_date',
'minimal_price','cost','tier_price','weight','tax_class_id');
foreach ($fieldList as $field) {
$applyTo = explode(',', $installer->getAttribute('catalog_product', $field, 'apply_to'));
if (!in_array('custproduct', $applyTo)) {
$applyTo[] = 'custproduct';
$installer->updateAttribute('catalog_product', $field, 'apply_to', join(',', $applyTo));
}
}
$installer->endSetup();
添加了属性“限制”,但它显示在所有产品类型上,我只需要我的自定义产品类型(custproduct)。
感谢回复我的问题现在解决了
刚刚向$fieldList 数组添加了“限制”
$fieldList = array('price','special_price','special_from_date','special_to_date',
'minimal_price','cost','tier_price','weight','tax_class_id', 'limits');
谢谢!!!
【问题讨论】:
-
你必须有一个新标签吗?你可以只使用现有的标签吗?
-
是的,我有新标签“价格 - 尺寸”,我只想为我的自定义产品类型显示它,目前它显示所有产品类型,如捆绑,简单,可下载我只想要 custproduct(我的自定义产品类型)仅限
-
Magento 不支持这个。它只支持设置自定义属性集(不支持选项卡)。您需要更改您的 AdminHTML 以实现此目的。
-
问题已经解决了谢谢:)
-
一切顺利!什么解决了这个问题?
标签: php magento magento-1.6