进入:magento\app\code\core\Mage\Adminhtml\Block\Catalog\Product\Grid.php
查找:protected function _prepareCollection()
{
$store = $this->_getStore();
$collection = Mage::getModel('catalog/product')->getCollection()
->addAttributeToSelect('sku')
->addAttributeToSelect('name')
->addAttributeToSelect('brand')
->addAttributeToSelect('attribute_set_id')
->addAttributeToSelect('type_id');
加粗部份为所加!
在159 line,也是name后加入:
/*brand*/
$brand_items= Mage::getModel('eav/entity_attribute_option')->getCollection()->setStoreFilter()->join('attribute','attribute.attribute_id=main_table.attribute_id', 'attribute_code');
foreach ($brand_items as $brand_item) :
if ($brand_item->getAttributeCode() == 'brand')
$brand_options[$brand_item->getOptionId()] = $brand_item->getValue();
endforeach;
$this->addColumn('brand',
array(
'header'=> Mage::helper('catalog')->__('Brand'),
'width' => '100px',
'type' => 'options',
'index' => 'brand',
'options' => $brand_options
));
/*brand*/
magento version:1.7.0.2 清除cache,re-login ,OK