Page 1 of 1

Change the number of items/page for a single category

Posted: Fri Nov 15, 2013 9:38 pm
by alindevil
I have created a category for Promotions and I want it to have a certain number of items/page which is different from the default items/page from the config and I also want it to default to GRID View without affecting the cookie that stores the default LIST View.

The Grid View thingy I figured it out already but I'm stuck with the first one.

What I'm trying to achieve is the same result as a link like this http://www.mysite.com/promotions?limit=24, but I want this behaviour by default for that category alone without the extra parameter in the link.

In /www/catalog/view/theme/{theme_name}/template/product/category.tpl i found this :

Code: Select all

<?php if ($limits['value'] == $limit) { ?>
so I presume that $limits['value'] is where I should change the value but I just can't figure it out where should I place some code like :

Code: Select all

$limits['value'] = 24;
or

Code: Select all

$limit = 24;
Is this the right way to achieve what I'm looking for ?

Re: Change the number of items/page for a single category

Posted: Sat Nov 16, 2013 7:51 am
by inactiveaccount9912
Edit catalog/controller/product/category.php and find the line:

Code: Select all

$category_info = $this->model_catalog_category->getCategory($category_id);
below it add:

Code: Select all

if($category_id == 9999) {
	    if (isset($this->request->get['limit'])) {
			$limit = $this->request->get['limit'];
		} else {
			$limit = 24;
		}
		}
in the above code 9999 is to be replaced by the id of the category you want.

This way youd have the default 24 or whatever number you input, yet if the customer selects other limit it would still work.