1

I want display sku at products ordered reports page, how can i get sku ?

enter image description here

5
  • u want sku column on grid Dec 3, 2016 at 9:42
  • yes... found solution,, below
    – Gem
    Dec 3, 2016 at 10:02
  • it not proper way to add sku you want extend to core block you own module Dec 3, 2016 at 10:06
  • @ArshadMuhammad please don't confuse people. Your method is considered as good practice. Dec 3, 2016 at 10:17
  • thanks @GopalPatel i don't confuse people just to share my knowledge Dec 3, 2016 at 10:46

3 Answers 3

5

open app\code\core\Mage\Adminhtml\Block\Report\Product\Sold\Grid.php and put the below code in _prepareColumns() function

You can move Grid.php in your local folder as well or can override it in custom module.

$this->addColumn('sku', array(
    'header'    => Mage::helper('reports')->__('Product Sku'),
    'index'     =>'sku'
));
2
  • 3
    better to avoid edits on core files.
    – Mujahidh
    Jan 6, 2017 at 10:12
  • this code is working only for simple products for me, do you have option for configurable?
    – Alam Zaib
    Dec 17, 2018 at 13:52
6

You should rewrite magento core block Mage_Adminhtml_Block_Report_Product_Sold_Grid, here is the solution:

<blocks>
    <adminhtml>
        <rewrite>
            <report_product_sold_grid>Namespace_Module_Block_Adminhtml_Order_Grid</report_product_sold_grid>
        </rewrite>
    </adminhtml>
</blocks>

and extend in your moduel:

class Namespace_Module_Block_Adminhtml_Order_Grid extends Mage_Adminhtml_Block_Report_Product_Sold_Grid
{

    public function _prepareColumns()
    {
        $this->addColumn('sku', array(
            'header' => Mage::helper('reports')->__('Product Sku'),
            'index' => 'sku'
        ));
        parent::_prepareColumns();
    }
}
6
  • But its working
    – Gem
    Dec 3, 2016 at 10:12
  • i.imgur.com/n5na90K.png
    – Gem
    Dec 3, 2016 at 10:13
  • Does right what i did...
    – Gem
    Dec 3, 2016 at 10:14
  • 1
    @JeevaRathinam yes it is right. His point is to override the grid in custom module which is good practice Dec 3, 2016 at 10:15
  • u can override hole methode you own function just comment parent::_prepareColumns(); Dec 3, 2016 at 10:18
0

The best solution is to create an extension for this functionality or just use mine

Magento 1.x Simple Products Report Extension

Your Answer

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

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