I want display sku at products ordered reports page, how can i get sku ?
-
u want sku column on grid– Arshad MuhammadDec 3, 2016 at 9:42
-
yes... found solution,, below– GemDec 3, 2016 at 10:02
-
it not proper way to add sku you want extend to core block you own module– Arshad MuhammadDec 3, 2016 at 10:06
-
@ArshadMuhammad please don't confuse people. Your method is considered as good practice.– Gopal PatelDec 3, 2016 at 10:17
-
thanks @GopalPatel i don't confuse people just to share my knowledge– Arshad MuhammadDec 3, 2016 at 10:46
3 Answers
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'
));
-
3
-
this code is working only for simple products for me, do you have option for configurable? Dec 17, 2018 at 13:52
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();
}
}
-
-
-
-
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
The best solution is to create an extension for this functionality or just use mine