gpt4 book ai didi

magento - 在 Magento admin 的网格中添加产品类型过滤器

转载 作者:行者123 更新时间:2023-12-05 00:35:04 25 4
gpt4 key购买 nike

在我的自定义模块中,我创建了一个加载所有产品的网格。我已经添加了以下列:

            $this->addColumn('entity_id', array(
'header' => Mage::helper('customer')->__('ID'),
'width' => '50px',
'index' => 'entity_id',
'type' => 'number',
));
$this->addColumn('name', array(
'header' => Mage::helper('customer')->__('Name'),
'index' => 'name'
));

$this->addColumn('price', array(
'header' => Mage::helper('catalog')->__('Price'),
'type' => 'currency',
'currency_code' => (string) Mage::getStoreConfig(Mage_Directory_Model_Currency::XML_PATH_CURRENCY_BASE),
'index' => 'price'
));

$this->addColumn('sku', array(
'header' => Mage::helper('catalog')->__('SKU'),
'width' => '90',
'index' => 'sku',
));
$this->addColumn('status', array(
'header' => Mage::helper('catalog')->__('Status'),
'align' => 'left',
'width' => '80px',
'index' => 'status',
'type' => 'options',
'options' => array(
1 => 'Enabled',
2 => 'Disabled',
),
));
$this->addColumn('type', array(
'header'=> Mage::helper('catalog')->__('Type'),
'width' => '60px',
'index' => 'type_id',
'type' => 'options',
'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
));

现在我想将产品类型列添加为下拉列表,以便我可以按产品类型过滤产品,即简单、可配置等。

已编辑

刚刚将它添加到函数中并且它起作用了:
$this->addColumn('type', array(
'header'=> Mage::helper('catalog')->__('Type'),
'width' => '60px',
'index' => 'type_id',
'type' => 'options',
'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
));

最佳答案

刚刚将它添加到函数中并且它起作用了:

$this->addColumn('type', array(
'header'=> Mage::helper('catalog')->__('Type'),
'width' => '60px',
'index' => 'type_id',
'type' => 'options',
'options' => Mage::getSingleton('catalog/product_type')->getOptionArray(),
));

关于magento - 在 Magento admin 的网格中添加产品类型过滤器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9904772/

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