Skip to content

Commit

Permalink
Grid columns for Category Products
Browse files Browse the repository at this point in the history
This change makes the Category Products grid having the same columns and format as the Related Products / Up-sells / Cross-sells grids.
  • Loading branch information
addison74 authored Mar 3, 2024
1 parent eaaa602 commit 191f050
Showing 1 changed file with 46 additions and 10 deletions.
56 changes: 46 additions & 10 deletions app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ protected function _prepareCollection()
'product_id=entity_id',
'category_id=' . (int) $this->getRequest()->getParam('id', 0),
'left'
);
$collection->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner');
)
->joinAttribute('status', 'catalog_product/status', 'entity_id', null, 'inner')
->joinAttribute('visibility', 'catalog_product/visibility', 'entity_id', null, 'inner');
$this->setCollection($collection);

if ($this->getCategory()->getProductsReadonly()) {
Expand Down Expand Up @@ -113,28 +114,69 @@ protected function _prepareColumns()
'index' => 'entity_id'
]);
}

$this->addColumn('entity_id', [
'header' => Mage::helper('catalog')->__('ID'),
'sortable' => true,
'width' => '60',
'index' => 'entity_id'
]);

$this->addColumn('name', [
'header' => Mage::helper('catalog')->__('Name'),
'index' => 'name'
]);

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

$sets = Mage::getResourceModel('eav/entity_attribute_set_collection')
->setEntityTypeFilter(Mage::getModel('catalog/product')->getResource()->getTypeId())
->load()
->toOptionHash();

$this->addColumn('set_name', [
'header' => Mage::helper('catalog')->__('Attrib. Set Name'),
'width' => 130,
'index' => 'attribute_set_id',
'type' => 'options',
'options' => $sets,
]);

$this->addColumn('status', [
'header' => Mage::helper('catalog')->__('Status'),
'width' => 90,
'index' => 'status',
'type' => 'options',
'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
]);

$this->addColumn('visibility', [
'header' => Mage::helper('catalog')->__('Visibility'),
'width' => 90,
'index' => 'visibility',
'type' => 'options',
'options' => Mage::getSingleton('catalog/product_visibility')->getOptionArray(),
]);

$this->addColumn('sku', [
'header' => Mage::helper('catalog')->__('SKU'),
'width' => '80',
'index' => 'sku'
]);

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

$this->addColumn('position', [
'header' => Mage::helper('catalog')->__('Position'),
'width' => '1',
Expand All @@ -143,13 +185,7 @@ protected function _prepareColumns()
'editable' => !$this->getCategory()->getProductsReadonly()
//'renderer' => 'adminhtml/widget_grid_column_renderer_input'
]);
$this->addColumn('status', [
'header' => Mage::helper('catalog')->__('Status'),
'width' => '70',
'index' => 'status',
'type' => 'options',
'options' => Mage::getSingleton('catalog/product_status')->getOptionArray(),
]);

$this->addColumn('action', [
'header' => Mage::helper('catalog')->__('Action'),
'width' => '50px',
Expand Down

0 comments on commit 191f050

Please sign in to comment.