In magento at the category of products I have two toolbars. At top toolbar I need only "Previous" and "Next" link. At the bottom toolbar I need "Total of Pages", "1, 2, 3 ... n-th nubmer of pages with link", and "Previous" and "Next" link. I create my new theme and template. From list.phtml I can get the block of pager.phtml with this code:

 <?php echo $this->getToolbarBlock()->getPagerHtml() ?>

But I need to obtain diferite template of pager.phtml for top-toolbar and for bottom-toolbar, how can I add a new template of pager.phtml?


So, I have created a new file toolbar-bottom.phtml and insert this code:

<?php echo $this->getPagerHtml() ?>

And in the list.phtml I insert this code:

<?php echo $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar-bottom.phtml')->toHtml(); ?>

And in toolbar.phtml I insert this code:

<?php $pagerBlock = $this->getChild('product_list_toolbar_pager');
                if($pagerBlock->getLastPageNum()>1): ?>
                    <div class="pagination_nav pagination_nav--small">

                    <?php if (!$pagerBlock->isFirstPage()): ?>
                        <a  href="<?php echo $pagerBlock->getPreviousPageUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Previous')) ?>">
                            <?php echo $this->__('&lt; Previous') ?>
                    <?php else:?>
                        <span  class="disabled"><?php echo $this->__('&lt; Previous') ?></span >
                    <?php endif;?>


                    if (!$pagerBlock->isLastPage()): ?>
                        <a href="<?php echo $pagerBlock->getNextPageUrl() ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Next')) ?>">
                            <?php echo $this->__('Next &gt;') ?>
                    <?php else:?>
                        <span class="disabled"><?php echo $this->__('Next &gt;') ?></span>
                    <?php endif;?>
                <?php endif;?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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