在Magento后台的Category页面的Category Products标签页,产品的Status并不显示,如果需要在产品表格中显示Status,可以做以下修改:
打开 /app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
在_prepareCollection()函数中,把
- $collection = Mage::getModel('catalog/product')->getCollection()
-
->addAttributeToSelect('name')
-
->addAttributeToSelect('sku')
-
->addAttributeToSelect('price')
-
->addStoreFilter($this->getRequest()->getParam('store'))
-
->joinField('position',
-
'catalog/category_product',
-
'position',
-
'product_id=entity_id',
-
'category_id='.(int) $this->getRequest()->getParam('id', 0),
-
'left');
修改为:
- $collection = Mage::getModel('catalog/product')->getCollection()
-
->addAttributeToSelect('name')
-
->addAttributeToSelect('sku')
-
->addAttributeToSelect('price')
-
->addStoreFilter($this->getRequest()->getParam('store'))
-
->joinField('position',
-
'catalog/category_product',
-
'position',
-
'product_id=entity_id',
-
'category_id='.(int) $this->getRequest()->getParam('id', 0),
-
'left')
-
->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner', $this->getRequest()->getParam('store'));
在_prepareColumns()函数中,在
- return parent::_prepareColumns();
上面添加:
- $this->addColumn('status',
-
array(
-
'header'=> Mage::helper('catalog')->__('Status'),
-
'width' => '70px',
-
'index' => 'status',
-
'type' => 'options',
-
'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
-
));
刷新后台Category页面,可以发现Status列显示在产品表格中。
阅读(1477) | 评论(0) | 转发(1) |