Magento pagination

...you will not beat me.

I find it a little deflating when you spend a lot of time on developing something and it just vanishes from sight. I have some nice pagination that worked outside of the toolbar a couple of days ago, but now...nothing. I'm always up for a challenge though, so let's fix this.

I had a bug in a template that had to be fixed, it was loading the page waaaay too slowly.

Anyways it reminded me I need to break the problem down so here goes.

Pagination on Magento is relatively simple.

In the backend, system > design menu you have some control over the pagination.

This should all work using the default template. And in my case it does.

The broken template is another story.

There are a number of components involved.

Firstly lets look at the app/design/frontend/<theme>/default/template/catalog/product files.

There's list.phtml and /list/toolbar.phtml.

It's the call to getPagerHtml() in toolbar.phtml that gets the pager "stuff".

That said though it's also referenced in /<theme>/default/layout/catalog.xml

<!--
Category default layout
-->

    <catalog_category_default translate="label">
        <label>Catalog Category (Non-Anchor)</label>
        <reference name="right">
            <block type="catalog/navigation" name="catalog.leftnav" after="cart_sidebar" template="catalog/navigation/left.phtml"/>
        </reference>
        <reference name="content">
            <block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
                <block type="catalog/product_list" name="product_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" />
                        <!-- The following code shows how to set your own pager increments -->

When all else fails and there doesn't appear to be a solution clearing the cache will bring any issues to the surface.

System > cache management

Flush the cache and refresh as well

Then check the logs.