Magento Themes and Magento Extensions

How to add additional row limit count in magento admin grid

Share

Magento Provides the Grid Based Layout in adminpanel pages for most of the pages like manage customers,manage products etc. The default row limit options are 20,50,100,200 etc per page. But for the stores with more than 1000 products and customers these options are not sufficient to display the records in less no. of pages.

Step 1: For this example we are going to add an additonal row limit count as 500. To do this locate the file which is reponsible for showing row count dropdown. The file is located in

app/design/adminhtml/default/default/template/widget/grid.phtml

Step 2: Around line 81 the code is located as shown below

<?php echo $this->__('View')  ?>
<select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getJsObjectName() ?>.loadByElement(this)">
<option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
<option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
<option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
<option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
<option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
</select>

Step 3: Add your custom limit after the last option tag as shown below, you can copy any of the option values and change the value.

<?php echo $this->__('View')  ?>
<select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getJsObjectName() ?>.loadByElement(this)">
<option value="20"<?php if($this->getCollection()->getPageSize()==20): ?> selected="selected"<?php endif; ?>>20</option>
<option value="30"<?php if($this->getCollection()->getPageSize()==30): ?> selected="selected"<?php endif; ?>>30</option>
<option value="50"<?php if($this->getCollection()->getPageSize()==50): ?> selected="selected"<?php endif; ?>>50</option>
<option value="100"<?php if($this->getCollection()->getPageSize()==100): ?> selected="selected"<?php endif; ?>>100</option>
<option value="200"<?php if($this->getCollection()->getPageSize()==200): ?> selected="selected"<?php endif; ?>>200</option>
<option value="500"<?php if($this->getCollection()->getPageSize()==500): ?> selected="selected"<?php endif; ?>>500</option>
</select>

Step 4: Now you will find our additional option displayed in all magento grids

magento admin grid

Leave a Reply

You must be logged in to post a comment.