Products list with pagination

Please LogIn to Reply!

Post By: admin | 26-01-2012 06:35 Reply

 

Hello everyone;
I need your help please.
I am looking for a tutorial that describes how to create a paginated list of products when creating a new module.
I tried to do but I failed: when I browse through the pages of my pagination the same products are displayed.
Thank you.

 

In app/code/local/My/Module/Block/Module.php

<?php
classMy_Module_Block_Module 
extends Mage_Core_Block_Template
{

protected function _prepareLayout()
    
{
        parent
::_prepareLayout();
        
$pager $this->getLayout()
            ->
createBlock('page/html_pager''module.pager')
            ->
setCollection($this->getModuleCollection());
        
        
$this->setChild('pager'$pager);
        
$this->getModule()->load();
        return 
$this;
    
}

    
public function getPagerHtml()
    
{
        
return $this->getChildHtml('pager');
    
}

.....
}

And in the template, module.phtml you need to include

<?php echo $this->getPagerHtml(); ?>

 Signature 

Thanks and regards
Sarath Tomy
Senior Software Engineer

E-Mail :
Skype : sarathtomy
Mobile : +(91)-9447134067
Follow me on Twitter @maanikunju

`Reply Or Comment!
Please LogIn to Reply!