Is it ever possible to customize default limits of showing products in each category by using XML Layout Update?
For example: I've got Clothes Category and Shoes Category. I need to show up only 10 products per page in Clothes Category (as default) and ALL products in Shoes Category by default. Could it be set up by Layout Update?
Thank you.
Hello,
You can do this by adding Custom Layout Update to categories:
<reference name="product_list"> <reference name="product_list_toolbar"> <action method="addPagerLimit"><mode>grid</mode><limit>3</limit></action> </reference> </reference>
add number of product per page to <limit> tag
Try to clear Magento Cache and refresh front-end Page.
Hi, thank you for your answer!
As I can see, method "addPagerLimit" adds new options to collapsing list. But I need to set up a default option on each category. System->Configuration->Catalog->Frontend->Products per Page on List Default Value = 25 and i need to override this value in some categories.
I tried to use the following code in custom design to update layout using your example:
<reference name="product_list"> <reference name="product_list_toolbar"> <action method="setDefaultListPerPage"><limit>5</limit></action> </reference> </reference>
But it doesn't work and there are 25 products instead of 5 on customized category list as well.
Could it be overridden somehow?
Thank you.
Hello,
You need to override pager number. So, we need to add Pager limit to our layout:
<reference name="product_list"> <reference name="product_list_toolbar"> <action method="setDefaultListPerPage"><limit>4</limit></action> <action method="addPagerLimit"><mode>list</mode><limit>4</limit></action> <action method="addPagerLimit"><mode>list</mode><limit>6</limit></action> <action method="addPagerLimit"><mode>list</mode><limit>8</limit></action> </reference> </reference>
Thank you, but it still doesn't work.
Default quantity of products on page doesn't change to new and keeps being equal to "Products per Page on List Default Value".
There is the code i'm using:
<reference name="product_list"> <reference name="product_list_toolbar"> <action method="setDefaultListPerPage"><limit>All</limit></action> <action method="addPagerLimit"><mode>list</mode><limit>5</limit></action> <action method="addPagerLimit"><mode>list</mode><limit>10</limit></action> <action method="addPagerLimit"><mode>list</mode><limit>15</limit></action> <action method="addPagerLimit"><mode>list</mode><limit>20</limit></action> <action method="addPagerLimit"><mode>list</mode><limit>25</limit></action> <action method="addPagerLimit" translate="label"><mode>list</mode><limit>all</limit><label>All</label></action> </reference> </reference>
Then I flush cache and it doesn't work. So sad.. That's kind of despair and it makes me barely cry.
By the way, I found out that I can't even add a new limit. "Products per Page on List Allowed Values" = 5,10,15,20,25.. If I add a line with a different limit like that, it goes in vain:
<action method="addPagerLimit"><mode>list</mode><limit>12</limit></action>
"12" appears in collapsing list, but when it is chosen, nothing changes..
Why is that happening? ;<
Hello,
I think <action method="setDefaultListPerPage"><limit>All</limit></action> doesn't work for us. This value should be in addPagerLimit values.
You added my example code lines? These lines didn't work?
Note: You choose list mode or grid mode on toolbar?
Hello,
I choose the list mode for sure.
Your lines didn'twork correctly. They only added new numbers to collapsing list. These numbers appeared in list but if I choose "4" for example, it doesn't change the limit of products on page. It keeps being aliquot to one of the numbers in "Products per Page on List Default Value".
Thank you.
Hello,
I got your point. By Magento Default, we cannot change the limit of products on a specific category page through XML layout update. My code lines only change products pager. We must custom Magento code. I have an idea:
-We should create an attribute for category, should be an input number, we will put the limit numbers of products.
-Re-collection products of category to set the limit of products.
Okay, I'll think about your idea.
Thank you for your answers and patience.