I am posting the way i did pagination in the My Wishlist Table .I used that way to paginate few other modules(self-built).
This is for1.4.0.1 I don't know about rest fo the version.
1.
code/core/Mage/Wishlist/Block/Customer/Wishlist.php
comment out the _prepareLayout function and add
protected function _prepareLayout()
{
parent::_prepareLayout();
$pager = $this->getLayout()->createBlock('page/html_pager', 'wishlist.customer.pager')
->setCollection($this->getWishlist());
$this->setChild('pager', $pager);
$this->getWishlist()->load();
return $this;
}
Add One more method in the same file wishlist.php
public function getPagerHtml()
{
return $this->getChildHtml('pager');
}
2 Open /app/design/frontend/base/default/template/wishlist/view.phtml
and add
getPagerHtml(); ?>
above
That's it.
If this is usefull to you don't forget to post the comment.
It doesn't work?? I am using magento 1.4.2 version. It gives me an error saying that getPagerHtml() is an undefined function!
ReplyDeleteOh okay..it works. It was a silly mistake. Thanks a lot for the code :)
ReplyDeleteNot working in magneto 1.5.1.0
ReplyDeleteclass Aarna_Designsubmit_Block_Designsubmit extends Mage_Core_Block_Template
ReplyDelete{
protected function _prepareLayout()
{
parent::_prepareLayout();
$pager = $this->getLayout()
->createBlock('page/html_pager', 'wishlist.customer.pager')
->setCollection($collection = Mage::getModel('customer/customer')
->getCollection()->addAttributeToSelect('*')->addFieldToFilter('group_id',4));
$this->setChild('pager', $pager);
return $this;
}
public function getPagerHtml()
{
return $this->getChildHtml('pager');
}
public function getDesignsubmit()
{
if (!$this->hasData('designsubmit')) {
$this->setData('designsubmit', Mage::registry('designsubmit'));
}
return $this->getData('designsubmit');
}
public function getAvatar( $customer_id )
{
$cpBlock = $this->getLayout()->getBlockSingleton('designsubmit/form_edit');
return $cpBlock->getAvatar( $customer_id );
}
hello
ReplyDeletei have added pagging in my custom module
but it is not working
please help
pagination is not working for my wishlist page..
ReplyDeleteplz help me..
Great blog. All posts have something to learn. Your work is very good and i appreciate you and hoping for some more informative posts.keep writing
ReplyDeletemagento development company in bangalore