Getting pager to show on magento list

后端 未结 1 1393
我在风中等你
我在风中等你 2021-01-15 04:31

We currently have a quote page which lists all existing quotes that we would like to show the pager.

We have the following code in the List page which we\'ve added t

相关标签:
1条回答
  • 2021-01-15 05:32

    We can implement custom model collection with magento pagination by extending Mage_Catalog_Block_Product_List class in our block class. Suppose I want to display users blog posts with pagination. Here is the steps to implement it easily:

    1. Create a block class (posts.php) and add the below code in it.

      class Blog_User_Block_Posts extends Mage_Catalog_Block_Product_List
      {
          protected function _beforeToHtml()
          {
              $toolbar = $this->getToolbarBlock();
              $collection = $this->_getPostsCollection();
              $toolbar->setCollection($collection);     /*(Add toolbar to collection)*/
              return parent::_beforeToHtml();
          }
      }
      
    2. In the view.phptml file add the below code in it

      <?php echo $this->getToolbarHtml() ?>
      
    0 讨论(0)
提交回复
热议问题