First of all, i didn't create custom module to handle this product collection, so, i just put model inside phtml file, i know it's bad implementation, i'm new in magento and i have to do small customization in loading product collection to the extension that bought by client.

This product collection is only showing up in specific category, so inside custom design tab in category management, i put this code :

<reference name="product_list">
<action method="setTemplate"><template>catalog/product/list_all.phtml</template></action>

And here is my query to load product collection, this query is inside list_all.phtml file :

$collection = Mage::getResourceModel('catalog/product_collection')
            ->addAttributeToFilter('groupdeal_status', Devinc_Groupdeals_Model_Source_Status::STATUS_RUNNING)

i've used this code to generate the pagination :

    $toolbar = Mage::getBlockSingleton('catalog/product_list')->getToolbarBlock();
    echo $toolbar->toHtml();

the code above only showing the products count and show per-page options, not 1,2,3..., links, i've also tried to use the code below :

$toolbar = Mage::getBlockSingleton('catalog/product_list')->getToolbarBlock();

echo $toolbar->getCollection()->getSize().'------'.var_dump($toolbar->getPages());

but, the var_dump returning NULL values. Should i create custom module to do this? or is there any ways to do this way, without creating custom module?? I've been trying to find a solutions about this, but most of the solution is using custom module.

2 Answers 2


Your concept is slightly lacking. The query should be at least moved outside of the template into Block class.

Then in the same class you can add something like this to solve your pagination issue:

protected function _beforeToHtml()
    $blockName = $this->getToolbarBlockName();
    if (!$blockName) {
        $blockName = 'product_list_toolbar';
                 'show_toolbar' => $this->getData('show_toolbar'),
                 'list_mode' => $this->getData('list_mode'),
                 '_current_limit' => $this->getData('limit')
                $blockName . '_pager',
                $this->getLayout()->createBlock('page/html_pager', $blockName . '_pager')

    return parent::_beforeToHtml();

Unless you make fun of reinventing the wheel you can also use this extension to create a listing of all products of your store along with couple of other useful listings:


  • Hi Tim, thanks for your reply, and for your extension, i've decided to use your extension, instead of using CMS page, can i use it in custom design tab inside category management? i've been trying to do that, but still no luck. Thanks! Commented Mar 18, 2014 at 7:28
  • No, the listing should be inside of CMS page but you can use design tab there. Commented Mar 18, 2014 at 7:39
  • Sorry for late reply Tim, thanks a lot!, it's working now. Commented Mar 24, 2014 at 12:28

This code help me with issues with pagination toolbar:

        $toolbar = Mage::getBlockSingleton('catalog/product_list')->getToolbarBlock();
        $layout = Mage::getSingleton('core/layout');
        $pager = $layout->createBlock('page/html_pager');
        $toolbar->setChild('product_list_toolbar_pager', $pager);
        echo $toolbar->toHtml();  // to Show toolbar
  • Yup this is working.. awesome +1
    – Amir Iqbal
    Commented Sep 24, 2016 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.