Tuesday, February 18, 2014

Magento : Add pagination to Wishlist


Create a custom module then override a core class 'Mage_Wishlist_Block_Customer_Wishlist'
and add following methods _prepareLayout(), getPagerHtml()
as
<?php
class Bd_Custommodulet_Block_Wishlist_Customer_Wishlist extends Mage_Wishlist_Block_Customer_Wishlist
{
/**
* Preparing global layout
*
* @return Mage_Wishlist_Block_Customer_Wishlist
*/
protected function _prepareLayout()
{
parent::_prepareLayout();
$pager = $this->getLayout()->createBlock('page/html_pager', 'wishlist.customer.pager');
$pager->setAvailableLimit(array(5=>5,10=>10,20=>20,'all'=>'all'));
$pager->setCollection($this->getWishlist());
$this->setChild('pager', $pager);
$this->getWishlist()->load();
return $this;
}
/**
* Pager HTML
*
* @return HTML
*/
public function getPagerHtml()
{
return $this->getChildHtml('pager');
}
}

After that add following code in /app/design/frontend/base/default/template/wishlist/view.phtml
<?php echo $this->getPagerHtml(); ?>

2 comments:

  1. Super-Duper site! I am loving it!! Will come back again - taking you feeds also, Thanks.

    Reply Delete
  2. Awesome article saved me hours!!

    Reply Delete

Subscribe to: Post Comments (Atom)

AltStyle によって変換されたページ (->オリジナル) /