Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Pagination without Toolbar
 
desquite
Jr. Member
 
Total Posts:  9
Joined:  2008-03-01
 

I’m trying to separate pagination from the toolbar when viewing a list of products.  The theme I’ve created shows the grid/list options at the top of the page and the pagination under the list of products.  What’s the best way to do this?  I need to get it working for the regular product list and the search results.  I have it working somewhat on the product list using the code below but I’m having trouble with the search results.  I’m not sure if this is the correct way to do things so please let me know if there is something better.

Thanks so much.

-- layout/catalog.xml --
<
catalog_category_default>
...
    <
block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
        <
block type="catalog/product_list" name="page_navigation" template="catalog/product/list/page_navigation.phtml" />
    </
block>                
...
</
catalog_category_default>

-- 
template/catalog/product/list/list.phtml --
<?php echo $this->getChildHtml('page_navigation'?>

-- template/catalog/product/list/page_navigation.phtml --
<?php
    
// manually get the toolbar block so we can do the page navigation
    
$toolbar $this->getToolbarBlock();
    
$toolbar->setCollection($this->_getProductCollection());
?>

<?php 
if($toolbar->getCollection()->getSize() && sizeof($toolbar->getPages()) > 1): ?>
    
<div class="pager">
        <
ul>
            <
li class="previous">
                
<?php if ($toolbar->isFirstPage()): ?>
                    <?php 
echo $toolbar->__('&laquo; Previous Page'?>
                <?php 
else: ?>
                    
<a href="<?php echo $toolbar->getPreviousPageUrl() ?>"><?php echo $toolbar->__('&laquo; Previous Page'?></a>
                
<?php endif; ?>
            
</li>
            
<?php foreach ($toolbar->getPages() as $_page): ?>
                <?php 
if ($toolbar->isPageCurrent($_page)): ?>
                    
<li class="current"><?php echo $_page ?></li>
                
<?php else: ?>
                    
<li><a href="<?php echo $toolbar->getPageUrl($_page) ?>"><?php echo $_page ?></a></li>
                
<?php endif ?>
            <?php 
endforeach;; ?>
            
<li class="next">
                
<?php if ($toolbar->isLastPage()): ?>
                    <?php 
echo $toolbar->__('Next Page &raquo;'?>
                <?php 
else: ?>
                    
<a href="<?php echo $toolbar->getNextPageUrl() ?>"><?php echo $toolbar->__('Next Page &raquo;'?></a>
                
<?php endif; ?>
            
</li>
        </
ul>
    </
div>
<?php endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
madog32
Jr. Member
 
Total Posts:  10
Joined:  2008-03-30
 

I’m Trying to do the same thing, can anyone help?

Thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
catbyte
Jr. Member
 
Total Posts:  3
Joined:  2008-05-23
 

Hello,

i need it too! - Is there a solution for this problem now?

Greets

 
Magento Community Magento Community
Magento Community
Magento Community
 
desquite
Jr. Member
 
Total Posts:  9
Joined:  2008-03-01
 

I don’t know of a prettier way to do this but the following code is working for me by inserting it directly into the list.phtml

-- add the following to template/catalog/product/list/list.phtml --

<?php
    
// manually get the toolbar block so we can do the page navigation
    
$toolbar $this->getToolbarBlock();
    
$toolbar->setCollection($this->_getProductCollection());
?>

<?php 
if($toolbar->getCollection()->getSize() && sizeof($toolbar->getPages()) > 1): ?>
    
<div class="pager">
        <
ul>
            <
li class="previous">
                
<?php if ($toolbar->isFirstPage()): ?>
                    <?php 
echo $toolbar->__('&laquo; Previous Page'?>
                <?php 
else: ?>
                    
<a href="<?php echo $toolbar->getPreviousPageUrl() ?>"><?php echo $toolbar->__('&laquo; Previous Page'?></a>
                
<?php endif; ?>
            
</li>
            
<?php foreach ($toolbar->getPages() as $_page): ?>
                <?php 
if ($toolbar->isPageCurrent($_page)): ?>
                    
<li class="current"><?php echo $_page ?></li>
                
<?php else: ?>
                    
<li><a href="<?php echo $toolbar->getPageUrl($_page) ?>"><?php echo $_page ?></a></li>
                
<?php endif ?>
            <?php 
endforeach;; ?>
            
<li class="next">
                
<?php if ($toolbar->isLastPage()): ?>
                    <?php 
echo $toolbar->__('Next Page &raquo;'?>
                <?php 
else: ?>
                    
<a href="<?php echo $toolbar->getNextPageUrl() ?>"><?php echo $toolbar->__('Next Page &raquo;'?></a>
                
<?php endif; ?>
            
</li>
        </
ul>
    </
div>
<?php endif; ?>
 
Magento Community Magento Community
Magento Community
Magento Community
 
industryx
Jr. Member
 
Total Posts:  7
Joined:  2008-06-26
 

Thanks a mill for the code desquite, I have this working, link:<a href="http://www.coloursofthesoul.com.au">Colours of the Soul</a> (my first Magento site)

The problem I have is when someone tries to link back to a products description page from the ‘recently viewed’ or ‘compare’ blocks for example, they get an error.

The site has 1 anchor category with 3 child categories.
If the product selected is in the same category as is currently being viewed, it works fine.
If you try to click back to a product in a different category is when you get the error.

Im not much of a programmer so any help to sort out this problem would be greatly appreciated.
As this was my first Magento store and I would love to get this clients site behind me and start working on the next one!

Thx

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tomas iTokas
Member
 
Total Posts:  44
Joined:  2010-06-07
 

I don’t know nut maybe my solution will help you.

I have commented out from toolbar.html parts of not necessary code. Now I have only pagination in toolbar.phtml

 
Magento Community Magento Community
Magento Community
Magento Community
 
palanikumark
Member
 
Total Posts:  66
Joined:  2010-01-03
 

Does the above coding is working? I placed the above coding in my list.phtml file. But it is not working. My magento version is 1.5.1.0. Can anyone help?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Andy_GS
Sr. Member
 
Total Posts:  126
Joined:  2010-05-21
 

Based on a couple of threads i read and a lot of trial and error,

i got 2 seperate toolbars for to and bottom of my grid view. I’m thinking this solution may help you because i wanted only paganation at the bottom and only sort orders at the top.

so first off in your theme under:

yourtheme/template/catalog/product/list/toolbar.phtml

duplicate this and call it say ‘toolbar-bottom.phtml’

then for my toolbar i wanted only paganation and the number of items listed in the bottom toolbar so my toolbar-bottom.phtml looks like this:

<?php if($this->getCollection()->getSize()): ?>
<div class="toolbar">
    <
div class="pager">
        <
class="amount">
            
<?php if($this->getLastPageNum()>1): ?>
                <?php 
echo $this->__('Items %s to %s of %s total'$this->getFirstNum(), $this->getLastNum(), $this->getTotalNum()) ?>
            <?php 
else: ?>
                
<strong><?php echo $this->__('%s Item(s)'$this->getTotalNum()) ?></strong>
            
<?php endif; ?>
        
</p>

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

    
</div>

</
div>
<?php endif ?>

then in my yourtheme/template/product/list.phtml i kept the top instance of:

<?php echo $this->getToolbarHtml() ?>
the same around line 42

then the bottom instance of that line of code around line 123 or so. i changed the syntax to read:

<?php echo $this->getToolbarBlock()->setTemplate('catalog/product/list/toolbar-bottom.phtml')->toHtml(); ?>
it may not be the best way to do it but it works for me.

hope that helps.

Andy.

 
Magento Community Magento Community
Magento Community
Magento Community
 
palanikumark
Member
 
Total Posts:  66
Joined:  2010-01-03
 

Thanks Andy. I got solution here. It works for me. Pagination without Toolbar

 
Magento Community Magento Community
Magento Community
Magento Community
 
Andy_GS
Sr. Member
 
Total Posts:  126
Joined:  2010-05-21
 

Good Times smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Iclicknetwork
Jr. Member
 
Avatar
Total Posts:  23
Joined:  2009-04-02
 

Hi,

Please check this extension, it have all feature to fit with your requirement about pagination

Magento Pagination

Thank you,
Tuan

 
Magento Community Magento Community
Magento Community
Magento Community
 
Mirasvit
Guru
 
Avatar
Total Posts:  639
Joined:  2009-08-22
 

Magento is really not ideal from the point of view of SEO. Very many obvious functions are implemented not quite right.  As a variant, you can try the ready extensions. For example, I use this one http://mirasvit.com/magento-extensions/advanced-seo-suite.html and very satisfied with results. There are a lot of similar extensions.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top