Default to 100 orders in sales order admin page
-
12-12-2019 - |
Question
Could someone help me with this,
I need to change the default number orders being showed in the Admin panel/Sales/Order view page. Currently it starts from 20 per page. I want to maintain that but still by default load the page by 100 orders.
I found the code for this view in app/design/adminhtml/default/template/widget/grid.phtml
<?php echo $this->__('of %s pages', $this->getCollection()->getLastPageNumber()) ?>
<span class="separator">|</span>
<?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" selected<?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>
<?php echo $this->__('per page') ?><span class="separator">|</span>
<?php echo $this->__('Total %d records found', $this->getCollection()->getSize()) ?>
I do not want to change the core grid.phtml. How can I do it.
Thanks
Solution
Create a local.xml in /app/design/adminhtml/default/default/layout/ (or a custom module) and add
<?xml version="1.0"?>
<layout version="0.1.0">
<adminhtml_sales_order_index>
<reference name="sales_order.grid">
<action method="setDefaultLimit">
<limit>100</limit>
</action>
</reference>
</adminhtml_sales_order_index>
<adminhtml_sales_order_grid>
<reference name="sales_order.grid">
<action method="setDefaultLimit">
<limit>100</limit>
</action>
</reference>
</adminhtml_sales_order_grid>
</layout>
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange