How can I add a SKU column in the Best Seller Product Report.
-
On admin dashboard?– Sukumar GoraiCommented Jul 6, 2018 at 10:54
-
@SukumarGorai could you pls explain brief?– zusCommented Jul 6, 2018 at 10:56
-
Can you please share the screenshot where you want this?– Sukumar GoraiCommented Jul 6, 2018 at 10:59
-
@SukumarGorai snag.gy/WqMbuB.jpg– zusCommented Jul 6, 2018 at 11:41
-
Pleae check my answer.– Sukumar GoraiCommented Jul 6, 2018 at 12:12
Add a comment
|
1 Answer
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!