Want to link to a product directly from the category page in the Magento admin? So did we. It ended up being rather simple and here’s how we did it:
Open the file /app/code/core/Mage/Adminhtml/Block/Catalog/Category/Tab/Product.php
You’ll see a function “protected function _prepareColumns()” around line 100. Within that function, you’ll see where all the columns get added to the Category Products tab. After the last column that’s being added and before the line “return parent::_prepareColumns();” add the following:
$this->addColumn('action',
array(
'header' => Mage::helper('catalog')->__('Action'),
'width' => '50px',
'type' => 'action',
'getter' => 'getId',
'actions' => array(
array(
'caption' => Mage::helper('catalog')->__('Edit'),
'url' => array(
'base'=>'*/catalog_product/edit',
'params'=>array('store'=>$this->getRequest()->getParam('store'))
),
'field' => 'id'
)
),
'filter' => false,
'sortable' => false,
'index' => 'stores',
));
Now we don’t have to keep 2 tabs open and go back and forth between the catagory page and product pages. There’s a link directly to the products within the category page. We’re running 1.4.2, but I suppose this should work with virtually any Magento version.
And obviously you may want to override the Magento core file by putting this in your own module so it doesn’t get removed when you upgrade the core.
