0

enter image description here

I tried changing default limit of product per page but its not changing. I want to change default limit from 20 to 10 without making changes in core file . And I want to do this in admin panel (Product View page) not in frontend.

Any suggestions?

1 Answer 1

3

Copy file :

app/code/core/Mage/Adminhtml/Block/Catalog/Product/Grid.php

To

app/code/local/Mage/Adminhtml/Block/Catalog/Product/Grid.php

add this protected var in this class

protected $_defaultLimit = 10;

Copy file

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

To

adminhtml/default/default/template/custom/grid.phtml

and set this as custom template for class

Mage_Adminhtml_Block_Catalog_Product_Grid

now change per page option (add for value 10) in file

adminhtml/default/default/template/custom/grid.phtml

<select name="<?php echo $this->getVarNameLimit() ?>" onchange="<?php echo $this->getJsObjectName() ?>.loadByElement(this)">
                <option value="10"<?php if($this->getCollection()->getPageSize()==10): ?> selected="selected"<?php endif; ?>>10</option>
                <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>  
9
  • how to set this as custom template for class??
    – Donika
    Oct 20, 2015 at 9:44
  • default limit changes on sales order page but not on product page
    – Donika
    Oct 20, 2015 at 9:59
  • "how to set this as custom template for class" in setTemplate in construct() function Oct 20, 2015 at 10:42
  • if you can tell me how to write exactly the it will be helpfull
    – Donika
    Oct 20, 2015 at 10:45
  • public function __construct() { parent::__construct(); $this->setTemplate("custom/grid.phtml"); $this->setId('productGrid'); $this->setDefaultSort('entity_id'); $this->setDefaultDir('DESC'); $this->setSaveParametersInSession(true); $this->setUseAjax(true); $this->setVarNameFilter('product_filter'); } Oct 20, 2015 at 10:50

Your Answer

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

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