Magento V1.7 Grid View - Add manufacturer attribute to view

前端 未结 2 1705
轮回少年
轮回少年 2021-01-26 07:23

On this page I want to add the Manufacturer name directly below the name of the item, but can\'t seem to get this to work. Have tried a number of suggestions, but none seem to

2条回答
  •  太阳男子
    2021-01-26 07:38

    $manufacturer_items = Mage::getModel('eav/entity_attribute_option')->getCollection()->setStoreFilter()
        ->join('attribute','attribute.attribute_id=main_table.attribute_id', 'attribute_code');
    
        foreach ($manufacturer_items as $manufacturer_item) :
            if ($manufacturer_item->getAttributeCode() == 'manufacturer')
            $manufacturer_options[$manufacturer_item->getOptionId()] = $manufacturer_item->getValue();
        endforeach;
    
        $this->addColumn('manufacturer',
            array(
            'header'=> Mage::helper('catalog')->__('Manufacturer'),
            'width' => '100px',
            'type'  => 'options',
            'index' => 'manufacturer',
            'options' => $manufacturer_options,
            ));
    

    Put this code in Gird.php file and this code in apoximate line number 58 to 63 in same file ->addAttributeToSelect('manufacturer')

提交回复
热议问题