Search code examples
magentopaginationtoolbar

Magento toolbar(sorting/pagination) not functional on custom page


I'm inheriting a project that allows the customer to view a product list based on manufacturer. The product list is being generated via the Manufacturer attribute for each product and accessed via a dropdown in the header. These are NOT CMS pages (there are hundreds of manufacturers so it's not practical to use CMS pages).

I am not sure if this was actually working at some point and stopped, or if it was never working to begin with and is only now being noticed by the client.

Either way, when you arrive on the 'manufacturer' page, the first page is displayed properly, and the dropdown to choose how many products are displayed works properly; however, the 'sort by' and pagination does not work. No matter what these options are set to, the list is always displayed the same way.

I have compared the custom-template.phtml file with catalog/product/list.phtml and they are basically the same (with minor changes for displaying a brand's logo, title, etc.).

Our brands.xml is loading the toolbar in exactly the same fashion as category.xml as well.

Also, the url displays properly as /brand/view/id/940/?p=4 for each page.

Any thoughts?


Solution

  • Essentially, I needed to add

     getCollection()->setCurPage($curPage)
    

    Or, alternatively, it appears that

     getCollection()->setPage($curPage,$pageSize)
    

    Does the same thing while also setting the number of products shown per page.