禁用magento捆绑产品价格类型下拉列表

时间:2015-08-11 08:01:13

标签: magento

为什么在我的商店管理面板中,price type下拉列表已停用,我可以通过disabled删除console属性或在其模板中添加自定义脚本来启用它。但这很脏。

导致此下拉列表的原因是什么?如何以更清洁的方式启用它?

screenshot

提前感谢。

1 个答案:

答案 0 :(得分:0)

我可以看到答案稍晚,但今天我遇到了同样的问题,这是解决方案:

当下拉价格类型显示为灰色时,表示您正在为捆绑产品使用非“默认”属性设置。

为了解决此问题,请创建安装/升级脚本,将“price_type”属性添加到捆绑产品将在您的系统中使用的所有属性集中(如下所示):

<?php

$installer = $this;
$installer->startSetup();

$attributeSetCollection = Mage::getResourceModel('eav/entity_attribute_set_collection')->load();

$productEntityTypeId = Mage::getModel('catalog/product')
    ->getResource()
    ->getEntityType()
    ->getId();

foreach ($attributeSetCollection as $id => $attributeSet) {
    $entityTypeId = $attributeSet->getEntityTypeId();

    if ($entityTypeId == $productEntityTypeId) {
        $this->addAttributeToSet($entityTypeId, $attributeSet->getAttributeSetId(), 'General', 'price_type', 200);
    }
}


$installer->endSetup();

执行此脚本后,price_type将与所有属性集建立关系,您的选择框将变为启用状态。

请注意,在admin中的属性集编辑屏幕下将不会显示该属性,但这并不意味着它未被分配。 如果你看看表:eav_entity_attributem你应该看到关系。

我希望这会解决你的一些问题。

相关问题