Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento add pager toolbar to wishlist

Tags:

magento

pager

Is it possible to use the catalog collection pager for the wishlist, and if so how can I implement this into the wishlist?

like image 342
ThreeCheeseHigh Avatar asked Aug 09 '11 09:08

ThreeCheeseHigh


1 Answers

danny (OP) already self-answered the question.

Quote:


Ok, i've found the solution here but i'll post it here too for a better code highlighting: Create a new modul and overwrite the wishlist block located in: code/core/Mage/Wishlist/Block/Customer/Wishlist.php and add the following to your Wishlist.php

class Company_Wishlist_Block_Customer_Wishlist extends Mage_Wishlist_Block_Customer_Wishlist
{
    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;
    }
    public function getPagerHtml()
    {
        return $this->getChildHtml('pager');
    }  
}

now add <?php echo $this->getPagerHtml(); ?> to the start and/or end of the view.phtml located in: app/design/frontend/default/your_theme/template/wishlist/view.phtml. that should do the trick.


Note: It's absolutely OK to self-answer your own question. Please just post it as an real answer, but not in a question or comment. Posting as real answer helps to keep the "Unanswered" list more clear (avoids making other people wasting their time).

like image 68
5 revs, 2 users 95% Avatar answered Sep 25 '22 04:09

5 revs, 2 users 95%