Search code examples
magentoreportsizesku

modify "sku" index column in Magento product sold report


I want to add a size column in Magento product sold report. Size value is the last character of sku. I already had sku column, fetching from database. But I don't know how to modify the value of sku to size column. Below is my code:

//sku column
$this->addColumn('sku', array(
    'header'    =>Mage::helper('reports')->__('Product Sku'),
    'width'     =>'250px',
    'index'     =>'sku',
    'type'      => 'text'
));
//size column
$this->addColumn('size', array(
    'header'    =>Mage::helper('reports')->__('Size'),
    'width'     =>'200px',
    'index'     =>'size'
));

I want to set size value = substr($sku,13,1).


Solution

  • You can modify the value of sku to size column by using custom renderer.

    Please follow this tutorial for that.

    http://inchoo.net/magento/how-to-add-custom-renderer-for-a-custom-column-in-magento-grid/