In your block's setCollection
function the first thing you do is parent::setCollection
. This will set the collection as is passed into the function. You then proceed to get new collections from a helper. But these are never set anywhere maybe you should move the call to parent::setCollection
until just before the return and then return $this
rather than $collection
This is how you can set custom toolbar and pager for your custom collection, below is an example shared, I am using this snippet currently.
Set Toolbar and Pager inside your phtml (your file that is to be called inside static block):
/* Set Toolbar Pagination for Custom Loaded Collection */
$toolbar = Mage::getBlockSingleton('catalog/product_list')->getToolbarBlock();
$toolbar->setCollection($_productCollection);
/* Set Pager */
$pager = $this->getLayout()->createBlock('page/html_pager', 'custom.pager');
$pager->setAvailableLimit(array($itemsLimit=>$itemsLimit));
$pager->setCollection($_productCollection);
$toolbar->addPagerLimit('grid', 50, 50);
$toolbar->addPagerLimit('grid', 75, 75);
$toolbar->addPagerLimit('grid', 100, 100);
$toolbar->setChild('product_list_toolbar_pager', $pager);
$toolbar->setData('_current_limit', $itemsLimit);
//Set order, define $sortBy and $orderBy
$toolbar->setData('_current_grid_order', $sortBy);
$toolbar->setData('_current_grid_direction', $orderBy);
To display toolbar on top of list, use :
<?php echo $toolbar->toHtml(); ?>
And to display pager on bottom, use :
<!-- Show Bottom Pagination Toolbar -- PAGER -->
<div class="toolbar-bottom">
<div class="toolbar">
<?php echo $pager->toHtml();?>
</div>
</div>
- Now you can call static block on a category page
- Then you can define your file path inside that static block
- Call your custom collection inside that file and use steps above
- And That's it :) Enjoy
Best Answer
Without editing the template files is not possible.
But here is a possible solution to hiding parts of the toolbar or splitting the toolbar in paging and sorting. One at the top and one at the bottom.
If you want to hide the full toolbar from the bottom, edit
catalog/product/list.phtml
and remove the linesOr you can do it via css by setting
display:none
for the.toolbar-bottom
class.