1

How can I add a SKU column in the Best Seller Product Report.

5
  • On admin dashboard? Commented Jul 6, 2018 at 10:54
  • @SukumarGorai could you pls explain brief?
    – zus
    Commented Jul 6, 2018 at 10:56
  • Can you please share the screenshot where you want this? Commented Jul 6, 2018 at 10:59
  • @SukumarGorai snag.gy/WqMbuB.jpg
    – zus
    Commented Jul 6, 2018 at 11:41
  • Pleae check my answer. Commented Jul 6, 2018 at 12:12

1 Answer 1

1

Step 1: Copy the below file:

app/code/core/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid.php

to

app/code/local/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid.php

and add the following code:

$this->addColumn('product_sku', array(
    'header'    => Mage::helper('sales')->__('Sku'),
    'index'     => 'product_id',
    'type'      => 'string',
    'sortable'  => false,
    'renderer'      => 'Mage_Adminhtml_Block_Report_Sales_Bestsellers_Grid_Sku'
));

Step 2: Create one file with name Sku.php under below path

app/code/local/Mage/Adminhtml/Block/Report/Sales/Bestsellers/Grid/Sku.php

Add the following code to Sku.php

<?php
class Mage_Adminhtml_Block_Report_Sales_Bestsellers_Grid_Sku extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
{
    public function render(Varien_Object $row) { 
        $productId =  $row->getData($this->getColumn()->getIndex());
        return Mage::getModel('catalog/product')->load($productId)->getSku();
    }
}

Clear the cache if you have enabled.

Thats it!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.