Display custom option quantity in manage product grid in magento

Here, we are going to write article about display custom option quantity in manage product grid in magento.

When you go to Catalog –> Manage Products, in grid only total qty is displayed. Our requirement was to display custom options and it’s qty there. So how to do that? Here is the trick.

Copy following file:

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php

Now create following folder structure in side app/code/local

Mage –>
Adminhtml –>
Block –>
Catalog –>
Product

And put grid.php file there. Now open grid.php file and find following code.

This is the qty column which displays total inventory quantity. We don’t want this so remove it and put following code instead of it.

Here we will use renderer to format the data we have to display. Now created Renderer folder in

app/code/local/Mage/Adminhtml/Block/Catalog/Product/

and create co.php file there and add following code there.

Here we are using product id to get product model and it’s custom options. foreach loop is used to iterate through custom options and get custom option title and qty. Here you can make any change in format if you want.

Please note that this code is tested in magento community version 1.7.0.2