1. Create a file in app\etc\modules\Techievolve_LowStockReport.xml
<?xml version="1.0" encoding="UTF-8"?> <config> <modules> <Techievolve_LowStockReport> <active>true</active> <codePool>local</codePool> </Techievolve_LowStockReport> </modules> </config>
2. Create a file in app\code\local\Techievolve\LowStockReport\etc\config.xml
<?xml version="1.0"?> <config> <modules> <Techievolve_LowStockReport> <version>1.0.0</version> </Techievolve_LowStockReport> </modules> <global> <blocks> <adminhtml> <rewrite> <report_product_lowstock_grid>Techievolve_LowStockReport_Block_Adminhtml_Report_Product_Lowstock_Grid</report_product_lowstock_grid> </rewrite> </adminhtml> </blocks> </global> </config>
3. Create a file in app\code\local\Techievolve\LowStockReport\Block\Adminhtml\Report\Product\Lowstock\Grid.php
<?php /** * Adminhtml low stock products report grid block override * * @category Report Collection * @author Sushant */ class Techievolve_LowStockReport_Block_Adminhtml_Report_Product_Lowstock_Grid extends Mage_Adminhtml_Block_Report_Product_Lowstock_Grid { protected function _prepareCollection() { if ($this->getRequest()->getParam('website')) { $storeIds = Mage::app()->getWebsite($this->getRequest()->getParam('website'))->getStoreIds(); $storeId = array_pop($storeIds); } else if ($this->getRequest()->getParam('group')) { $storeIds = Mage::app()->getGroup($this->getRequest()->getParam('group'))->getStoreIds(); $storeId = array_pop($storeIds); } else if ($this->getRequest()->getParam('store')) { $storeId = (int)$this->getRequest()->getParam('store'); } else { $storeId = ''; } /** @var $collection Mage_Reports_Model_Resource_Product_Lowstock_Collection */ $collection = Mage::getResourceModel('reports/product_lowstock_collection') ->addAttributeToSelect('*') ->addAttributeToFilter('status', '1') ->setStoreId($storeId) ->filterByIsQtyProductTypes() ->joinInventoryItem('qty') ->useManageStockFilter($storeId) ->useNotifyStockQtyFilter($storeId) ->setOrder('qty', Varien_Data_Collection::SORT_ORDER_ASC); if( $storeId ) { $collection->addStoreFilter($storeId); } //echo "<pre>"; print_r($collection->getData()); exit; $this->setCollection($collection); //return parent::_prepareCollection(); return Mage_Adminhtml_Block_Widget_Grid::_prepareColumns(); } }
0 Comments