cancel
Showing results for 
Search instead for 
Did you mean: 

add additional field to the product display grid

add additional field to the product display grid

When I say product display grid, I'm talking about the full list of products in the admin area.  I need to add one possibly two additional fields: manufacturer and manufacturer part no.

 

We don't use the same SKU's as the supplier since their SKU's will vary in some cases from the actual product.

 

Any help with this, would be greatly appreciated.

 

 

 

 

2 REPLIES 2

Re: add additional field to the product display grid

There are two ways to acheive your needs. Either you can rewrite grid class (Mage_Adminhtml_Block_Catalog_Product_Grid Or use event observer method. I suggest to use event observer, see I.E

 

Declare observer into config.xml

 <adminhtml>
        <events>
            <core_block_abstract_prepare_layout_before>
                <observers>
                    <customgrid_column_append>
                        <type>model</type>
                        <class>Atwix_CustomGrid_Model_Observer</class>
                        <method>appendCustomColumn</method>
                    </customgrid_column_append>
                </observers>
            </core_block_abstract_prepare_layout_before>
        </events>
    </adminhtml>

 

Create observer class inside Model with appropriate method.

 

public function appendCustomColumn(Varien_Event_Observer $observer)
    {
        $block = $observer->getBlock();
        if (!isset($block)) {
            return $this;
        }

        if ($block->getType() == 'adminhtml/catalog_product_grid') {
            $block->addColumnAfter('status', array(
                'header'    => 'status',
                'type'      => 'text',
                'index'     => 'status',
            ), 'sku');
        }
    }

Replace "status" with your custom attributes.

 

All the best, cheers Smiley Happy

 

 

-
Magento Programmer | Was my answer helpful? You can accept it as a solution.

Re: add additional field to the product display grid

Actually I found an example online late last night that is very very simple.  I'll post the link when I get home, I did not send it to the office.

 

But basically it was just modifying the GRID.php file in two places, one for the get and the other for the header. 

 

I copied the grid to the local directory so it won't get changed on an upgrade.