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

Page 2 of 3
1.4.0 layouts update, pagination issue & new toolbar.phtml
 
Tomakun
Sr. Member
 
Total Posts:  77
Joined:  2008-10-21
 

I agree. If Varien would consider being more communicative and giving us at least small documentations and clear guidelines, there wouldn’t be that much complaints. They brought this on themselves and I hope they’ll get tons of bad feedback on the internet and suffer financially. Otherwise nobody over there will react.

I mean, I love Magento and I’m thankful for this product, but I hope Varien will get hurt for being silent with the community. How is that for a nonsense?!

 
Magento Community Magento Community
Magento Community
Magento Community
 
DCAlmeida
Sr. Member
 
Avatar
Total Posts:  164
Joined:  2008-12-28
PRT
 

Simple, add this:

/* Pager */
.pager { font-size:11px; background:#fff url(../images/bkg_toolbar.gif) 0 100% repeat-x; padding:4px 8px; border-top:1px solid #e2e2e2; text-align:center; }
.pager .amount { float:left; margin:0; }
.pager .limiter { float:right; }
.pager .limiter label { vertical-align:middle; }
.pager .limiter select { padding:0; margin:0 0 1px; vertical-align:middle; }
.pager .pages { margin:0 140px; }
.pager .pages ol { display:inline; }
.pager .pages li { display:inline; margin:0 2px; }
.pager .pages .current {}

/* Sorter */
.sorter { font-size:11px; background:#fff url(../images/bkg_toolbar.gif) 0 100% repeat-x; padding:3px 8px; border-top:1px solid #e2e2e2; }
.sorter .view-mode { float:left; margin:0; }
.sorter .sort-by { float:right; padding-right:36px; }
.sorter .sort-by label { vertical-align:middle; }
.sorter .sort-by select { padding:0; margin:0 0 1px; vertical-align:middle; }
.sorter .link-feed {}

/* Toolbar */
.toolbar {}
.toolbar .pager { padding:3px 8px; border-bottom:1px solid #fff; }
.toolbar .sorter { border-bottom:1px solid #fff; }
.toolbar-bottom {}

to your css, then add a br tag at the end of toolbal.phtml and that´s it!
You can see that old toolbar are showed inside a table, the new one is tableless!

If you test my tip tell me if worked. With me at all 3 stores worked fine!

 
Magento Community Magento Community
Magento Community
Magento Community
 
comodo
Jr. Member
 
Total Posts:  25
Joined:  2007-12-13
 
misterMan - 22 February 2010 08:12 PM

Okay, so I did all the above items and my categories work, BUT I now have the unsightly mess of pagination as seen in my screen shot.

Does anyone have a fix for this? I have been trying to merge the two toolbar files but my eyes( and brain) are growing very fuzzy as I’ve been dealing with this for some time. Can anyone help? A simple merged toolbar file to download would be the best.

Thanks a ton!

PS This is the default theme. No customization.
PSS I tried replacing the pager.phtml and still the same look. I am now lost…

Help!

Here is the new toolbar.phtml…

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2009 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Product list toolbar
 *
 * @see Mage_Catalog_Block_Product_List_Toolbar
 */
?>
<?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>

        <
div class="limiter">
            <
label><?php echo $this->__('Show'?></label>
            <
select onchange="setLocation(this.value)">
            
<?php foreach ($this->getAvailableLimit() as  $_key=>$_limit): ?>
                
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
                    
<?php echo $_limit ?>
                
</option>
            
<?php endforeach; ?>
            
</select<?php echo $this->__('per page'?>
        
</div>

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

    
</div>

    
<?php if( $this->isExpanded() ): ?>
    
<div class="sorter">
        
<?php if( $this->isEnabledViewSwitcher() ): ?>
        
<class="view-mode">
            
<?php $_modes $this->getModes(); ?>
            <?php 
if($_modes && count($_modes)>1): ?>
            
<label><?php echo $this->__('View as'?>:</label>
            
<?php foreach ($this->getModes() as $_code=>$_label): ?>
                <?php 
if($this->isModeActive($_code)): ?>
                    
<strong title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></strong>&nbsp;
                
<?php else: ?>
                    
<a href="<?php echo $this->getModeUrl($_code) ?>" title="<?php echo $_label ?>" class="<?php echo strtolower($_code); ?>"><?php echo $_label ?></a>&nbsp;
                
<?php endif; ?>
            <?php 
endforeach; ?>
            <?php 
endif; ?>
        
</p>
        
<?php endif; ?>
    
        
<div class="sort-by">
            <
label><?php echo $this->__('Sort by'?></label>
            <
select onchange="setLocation(this.value)">
            
<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
                
<option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
                    
<?php echo $_order ?>
                
</option>
            
<?php endforeach; ?>
            
</select>
            
<?php if($this->getCurrentDirection() == 'desc'): ?>
                
<a href="<?php echo $this->getOrderUrl(null, 'asc') ?>" title="<?php echo $this->__('Set Ascending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
            
<?php else: ?>
                
<a href="<?php echo $this->getOrderUrl(null, 'desc') ?>" title="<?php echo $this->__('Set Descending Direction') ?>"><img src="<?php echo $this->getSkinUrl('images/i_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
            
<?php endif; ?>
        
</div>
    </
div>
    
<?php endif; ?>
</div>
<?php endif ?>

And here is the old…

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   design_default
 * @package    Mage
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Product list toolbar
 *
 * @see Mage_Catalog_Block_Product_List_Toolbar
 */
?>
<?php 
if($this->getCollection()->getSize()): ?>
    
<table class="pager" cellspacing="0">
        <
tr>
            <
td>
            
<?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; ?>
            
</td>
            
<?php if($this->getLastPageNum()>1): ?>
            
<td class="pages">
                <
strong><?php echo $this->__('Page:'?></strong>
                <
ol>
                
<?php if (!$this->isFirstPage()): ?>
                    
<li><a href="<?php echo $this->getPreviousPageUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_left.gif') ?>" alt="<?php echo $this->__('Previous') ?>" /></a></li>
                
<?php endif ?>
                <?php 
foreach ($this->getPages() as $_page): ?>
                    <?php 
if ($this->isPageCurrent($_page)): ?>
                        
<li><span class="on"><?php echo $_page ?></span></li>
                    
<?php else: ?>
                        
<li><a href="<?php echo $this->getPageUrl($_page) ?>"><?php echo $_page ?></a></li>
                    
<?php endif ?>
                <?php 
endforeach;; ?>
                <?php 
if (!$this->isLastPage()): ?>
                    
<li><a href="<?php echo $this->getNextPageUrl() ?>"><img src="<?php echo $this->getSkinUrl('images/pager_arrow_right.gif') ?>" alt="<?php echo $this->__('Next') ?>" /></a></li>
                
<?php endif ?>
                
</ol>
            </
td>
            
<?php endif; ?>
            
<td class="a-right">
                
<?php echo $this->__('Show'?> <select onchange="setLocation(this.value)">
                
<?php foreach ($this->getAvailableLimit() as  $_key=>$_limit): ?>
                    
<option value="<?php echo $this->getLimitUrl($_key) ?>"<?php if($this->isLimitCurrent($_key)): ?> selected="selected"<?php endif ?>>
                        
<?php echo $_limit ?>
                    
</option>
                
<?php endforeach; ?>
                
</select<?php echo $this->__('per page'?>
            
</td>
        </
tr>
    </
table>
    
<?php if( $this->isExpanded() ): ?>
    
<table class="view-by" cellspacing="0">
        <
tr>
            
<?php if( $this->isEnabledViewSwitcher() ): ?>
            
<td>
                
<?php $_modes $this->getModes(); ?>
                <?php 
if($_modes && count($_modes)>1): ?>
                <?php 
echo $this->__('View as'?>:
                
<?php foreach ($this->getModes() as $_code=>$_label): ?>
                    <?php 
if($this->isModeActive($_code)): ?>
                        
<strong><?php echo $_label ?></strong>&nbsp;
                    
<?php else: ?>
                        
<a href="<?php echo $this->getModeUrl($_code) ?>"><?php echo $_label ?></a>&nbsp;
                    
<?php endif; ?>
                <?php 
endforeach; ?>
                <?php 
endif; ?>
            
</td>
            
<?php endif; ?>
            
<td class="sort-by">
                
<?php echo $this->__('Sort by'?> <select onchange="setLocation(this.value)">
                
<?php foreach($this->getAvailableOrders() as $_key=>$_order): ?>
                    
<option value="<?php echo $this->getOrderUrl($_key, 'asc') ?>"<?php if($this->isOrderCurrent($_key)): ?> selected="selected"<?php endif; ?>>
                        
<?php echo $_order ?>
                    
</option>
                
<?php endforeach; ?>
                
</select>
                
<?php if($this->getCurrentDirection() == 'desc'): ?>
                    
<a href="<?php echo $this->getOrderUrl(null, 'asc') ?>"><img src="<?php echo $this->getSkinUrl('images/sort_desc_arrow.gif') ?>" alt="<?php echo $this->__('Set Ascending Direction') ?>" class="v-middle" /></a>
                
<?php else: ?>
                    
<a href="<?php echo $this->getOrderUrl(null, 'desc') ?>"><img src="<?php echo $this->getSkinUrl('images/sort_asc_arrow.gif') ?>" alt="<?php echo $this->__('Set Descending Direction') ?>" class="v-middle" /></a>
                
<?php endif; ?>
            
</td>
        </
tr>
    </
table>
    
<?php endif; ?>
<?php 
endif ?>

Am I in the right page or should it be the pager.phtml that I need to update?

Thanks again.

I had also this issue. What I did? I have deleted folders Layout and Template from app/design/frontend/default/default because there is no need to have this, there are already moved in app/design/frontend/base/default

 
Magento Community Magento Community
Magento Community
Magento Community
 
rexcel
Jr. Member
 
Total Posts:  3
Joined:  2009-11-30
 

Thought might be helpful for others to set pagination for search and advance search results

go to /app/design/frontend/default/THEME/layout/catalogssearch.xml

under <catalogsearch_result_index>
find

<block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml"></block>
replace
<block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>

do the same for <catalogsearch_advanced_result>

 
Magento Community Magento Community
Magento Community
Magento Community
 
DCAlmeida
Sr. Member
 
Avatar
Total Posts:  164
Joined:  2008-12-28
PRT
 

You rock rexcel!
Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
Galaxy Of Vitality
Jr. Member
 
Avatar
Total Posts:  27
Joined:  2008-04-01
 

Ok so done all the fixes and my categories now display ok, but the individual product pages display an error page.... any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
PimSchaaf
Jr. Member
 
Total Posts:  13
Joined:  2008-09-08
Rotterdam
 

After updating and fixing the categories, pages with products started showing up again. I noticed though that all pages with more than 9 products didn’t work, instead gave an error.

When I increase the standard value for products shown per page in the backend these errors disappear so I am pretty sure this has to do with the pagination.

Does anyone recognize this behavior, and does anyone have a solution to this problem other than raising the standard value wink.

Sincere thanks for all the support that at least brought me this far!

 
Magento Community Magento Community
Magento Community
Magento Community
 
DCAlmeida
Sr. Member
 
Avatar
Total Posts:  164
Joined:  2008-12-28
PRT
 

Your problem can be fixed following all instructions in this thread!

 
Magento Community Magento Community
Magento Community
Magento Community
 
PimSchaaf
Jr. Member
 
Total Posts:  13
Joined:  2008-09-08
Rotterdam
 

Thanks for your quick response. I must have missed something or made a mistake!

 
Magento Community Magento Community
Magento Community
Magento Community
 
furniture2home
Jr. Member
 
Total Posts:  29
Joined:  2009-12-18
 

Hi, can anyone help? we followed all insctructions and its perfectly works, so all categories and search result are fine. The catalognew and catalogsale anyway was not displaying pages, so I applied same things as to search and advanced search codes given earlier in post and these pages are fixed now too. But can not make work cms pages where we use Yoast filter, so we have cms pages that call by this filter products by attributes
The original filter file looks so:

<layout version="0.0.1">
<filter_index_view>
<reference name="content">
<block type="Yoast_Filter/View" name="filter.head" template="filter/view.phtml"/>
<block type="Yoast_Filter/View" name="filter_view" template="catalog/product/list.phtml"/>
</reference>
</filter_index_view>
</layout>

I tried all possible variations and can not make it work (its need refreshing cache after any updates)

I would think some thing like this should work:

<layout version="0.0.1">
<filter_index_view>
<reference name="content">
<block type="Yoast_Filter/View" name="filter.head" template="filter/view.phtml"/>
<block type="Yoast_Filter/View" name="filter_view" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</reference>
</filter_index_view>
</layout>

But it does not, what I am missing

 
Magento Community Magento Community
Magento Community
Magento Community
 
furniture2home
Jr. Member
 
Total Posts:  29
Joined:  2009-12-18
 

Hi, can anyone help? we followed all insctructions and its perfectly works, so all categories and search result are fine. The catalognew and catalogsale anyway was not displaying pages, so I applied same things as to search and advanced search codes given earlier in post and these pages are fixed now too. But can not make work cms pages where we use Yoast filter, so we have cms pages that call by this filter products by attributes
The original filter file looks so:

<layout version="0.0.1">
<filter_index_view>
<reference name="content">
<block type="Yoast_Filter/View" name="filter.head" template="filter/view.phtml"/>
<block type="Yoast_Filter/View" name="filter_view" template="catalog/product/list.phtml"/>
</reference>
</filter_index_view>
</layout>

I tried all possible variations and can not make it work (its need refreshing cache after any updates)

I would think some thing like this should work:

<layout version="0.0.1">
<filter_index_view>
<reference name="content">
<block type="Yoast_Filter/View" name="filter.head" template="filter/view.phtml"/>
<block type="Yoast_Filter/View" name="filter_view" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
</block>
</reference>
</filter_index_view>
</layout>

But it does not, what I am missing

 
Magento Community Magento Community
Magento Community
Magento Community
 
Qvist
Jr. Member
 
Total Posts:  8
Joined:  2010-03-22
 

Does anyone have an answer for this ?

Following quote from (http://www.magentocommerce.com/boards/viewthread/176287/)

I’ve added this block on my “home” page to list all my shop’s product on the front pages
{{block type=\"catalog/product_list\" name=\"home.catalog.product.list\" alias=\"products_homepage\" template=\"catalog/product/list.phtml\"}}

problem is that the block doesn’t show the pager in the toolbar, so there is no way of navigating though the products.

Any one who has an Idea of why the pager is gone and how to get it to show?

the pager works if I go to a category page like ..../index.php/parts.html

Hoping for a quick answer

 
Magento Community Magento Community
Magento Community
Magento Community
 
mig500
Jr. Member
 
Total Posts:  11
Joined:  2009-02-16
 

Fast solution

http://www.brightyoursite.com/blog/2010/03/06/invalid-argument-supplied-for-foreach-&#xE2;&#x80;&#xA6;-toolbar-phtml/

“After post this article , i got same error on shop by brand page , after try many times test , i find a another way : open

/public_html/app/code/core/Mage/Catalog/Block/Product/List/Toolbar.php

if you see

class Mage_Catalog_Block_Product_List_Toolbar extends Mage_Core_Block_Template

just change it to

class Mage_Catalog_Block_Product_List_Toolbar extends Mage_Page_Block_Html_Pager

then update the file . Refresh the page then it work .Hope this can help you !!! Happy reading !!!”

 
Magento Community Magento Community
Magento Community
Magento Community
 
shani1351
Sr. Member
 
Total Posts:  156
Joined:  2010-01-24
 

Hello,

I\’m using this template as the base of my template and Magento ver. 1.4.0.1. There was a problem with the pagination so I used the instruction on this thread to fix this. I don\’t get an error anymore but I don\’t have pagination. There is the toolbar with :

Items 1 to 9 of 50 total
Show per page

View as: Grid List
Sort

but theres no option to go through the pages.

Any ideas what can be the problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
chiefair
Mentor
 
Avatar
Total Posts:  1848
Joined:  2009-06-04
 

@shani

Did you edit the catalog.xml file as described?

<block type=\"catalog/product_list_toolbar\" name=\"product_list_toolbar\" template=\"catalog/product/list/toolbar.phtml\">
<block type=\"page/html_pager\" name=\"product_list_toolbar_pager\"/>
<!-- The following code shows how to set your own pager increments -->

Note where middle line is placed. This is what shows the clickable results so you can move back and forth through the results pages.

Summary of what I followed to get it working:

Anton\’s Link Basically replace toolbar.phtml and pager.phtml in templates and do the above edit to catalog.xml

DCA\’s css and reminder on <br> tag after <div class=\"sort-by\"> block

The next step is to take care of search results pages, they typically are missing the reference to loading the pager.html block, and a fix is described over on

NOAM Design here

Thanks to all who helped, much appreciated!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 2 of 3