2012-03-28 93 views
4

在我的自定义模块中,我创建了一个加载所有产品的网格。我有以下栏目已经增加:在Magento网格中添加产品类型过滤器admin

  $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(), 
      )); 

现在我想增加产品类型列添加为一个下拉,这样我可以筛选产品通过货号类型,即简单,配置等

EDITTED

只是添加了这个的功能和它的工作:

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

回答

6

刚刚将该的功能和它的工作原理:

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