0

I wanted to display all products from my store on homepage, to do that I used this piece of code in my CMS Home Page item.

{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" template="catalog/product/list.phtml" column_count="4"}}

After that I wanted to modify how pagination looks under my categories. I didn't want pagination to be shown both on top and bottom of my category list, so I have removed $this->getPagerHtml() from list/toolbar.phtml, and I have also removed $this->getToolbarHtml() from the bottom of list.phtml and replaced it with $this->getChild('product_list_toolbar')->getPagerHtml();.

That gave desired result of having pagination only at the bottom of category list but when I open homepage, I get message that webshop is not available.

If I roll back the changes, items from all categories are displayed again on the homepage.

What I have noticed is that even though pagination is shown (without my modifications) on categories, homepage which should display all store items doesn't have pagination.

I'm guessing it's some kind of error because my homepage doesn't have access to pagination object?

Thanks in advance!

  • The catalog.xml file sets up the parent/child relationship for the layout handle. You are however not in one of those layout handles. – Melvyn Feb 27 '15 at 18:49
  • So what does that mean in my case @Melvyn? How can I do that if I'm trying to display my shop through CMS block? – Reygoch Feb 27 '15 at 18:54
  • Not able to check now, but getToolbarHtml() works, right? Is there any magic in there that loads product_list_toolbar child if undefined? Kinda weird that that does work. – Melvyn Feb 27 '15 at 19:05
  • yes, I get the toolbar, but no pagination, even though it's visible on category pages. It does however say 1-12 of 116 for item count. – Reygoch Feb 27 '15 at 19:26
0

Create or update the file called local.xml in your layout directory of your package/theme folder:

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <cms_index_index>
        <reference name="home.catalog.product.list">
            <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>
        </reference>
    </cms_index_index>
</layout>

This should create the child relationship for the toolbar and pager. As you can see in Mage_Catalog_Block_Product_List_Toolbar::getPagerHtml() the name is hardcoded. The usual cache flush required.

You probably want to change the toolbar template file, if you want to keep the original toolbar for the product list on categories.

  • Hm... unfortunately I still get "shop is not available" message if I put pager in my category list phtml, and if I leave original magento files I get no pagination on shop homepage, even though products are listed. – Reygoch Feb 28 '15 at 11:54

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.