Page 1 of 1

2nd page repeat items

Posted: Sun Oct 16, 2011 2:17 am
by spirit
Hi guys.

I don't know if this trouble was solved but i didn't found nothing in the forum search :/
In category, the 2nd page repeat 1rst page items... how can i fix it?

For example: total items in category A: 15 items
My site show 12 items per page. In the 1rst page, i can see 12 items but in the 2nd page, i see 3 duplicate items. So, 3 items are missed :/

I'm using 1.5.1.1
Sorry for my english,

Thanks a lot.

Re: 2nd page repeat items

Posted: Mon Oct 17, 2011 9:14 am
by Daniel
upgrade.

Re: 2nd page repeat items

Posted: Tue Oct 25, 2011 2:12 pm
by spirit
Daniel wrote:upgrade.
Thanks, but how can i fix it?
I don't want change my OC version yet (i'm using 1.5.1.1).

Re: 2nd page repeat items

Posted: Wed Oct 26, 2011 1:33 pm
by Daniel
search the svn.

Re: 2nd page repeat items

Posted: Wed Oct 26, 2011 7:05 pm
by JSSL
Had the same problem, it's just the sorting method that gives this problem.

I hope I can explain it to you:
go to: catelog/controller/product/category.tpl

Find:

Code: Select all

if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'p.sort_order';
		}

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'ASC';
		}
Change This:
'p.sort_order'
to:
'pd.name' if you want to sort on name, when Z -> A then you have to change the ASC in the code to DESC.

if you want to sort on price: 'p.price' same here when decreasing prices, change to DESC.

Then it won't give problems anymore.
Hope it will help.

Re: 2nd page repeat items

Posted: Thu Oct 27, 2011 12:34 am
by spirit
Thanks JSSL.

I did this:

Code: Select all

if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'p.date_added';
		}

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'DESC';
		}
And in line 128, i did this:

Code: Select all

foreach ($results as $result) {
			$data = array(
			'filter_category_id' => $result['category_id'],
			'filter_sub_category' => true	
			);

			$product_total = $this->model_catalog_product->getTotalProducts($data);
				
				$this->data['categories'][] = array(
					'name'  => $result['name'] . ' (' . $product_total . ')',
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);
			}
Now, categories and sub-categories, work fine (no repeat items in the 2nd and next pages).
Thanks guys.

Re: 2nd page repeat items

Posted: Mon Nov 07, 2011 11:48 pm
by AnonyMoose
JSSL wrote:Had the same problem, it's just the sorting method that gives this problem.

I hope I can explain it to you:
go to: catelog/controller/product/category.tpl

Find:

Code: Select all

if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'p.sort_order';
		}

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'ASC';
		}
Change This:
'p.sort_order'
to:
'pd.name' if you want to sort on name, when Z -> A then you have to change the ASC in the code to DESC.

if you want to sort on price: 'p.price' same here when decreasing prices, change to DESC.

Then it won't give problems anymore.
Hope it will help.

Thanks a lot, I tried other fixes suggested in different topics but ours worked perfect!

By the way upgrading doesn't solve the problem, I'm on 1.5.1.3 and had duplicates too.

Re: 2nd page repeat items

Posted: Tue Nov 08, 2011 12:29 am
by Daniel
i did set it to sort by name a while ago but got complaints from people that they wanted a sort order. now it causes problems.

one way to solve it is to add a sort order for ever product.

Re: 2nd page repeat items

Posted: Tue Nov 08, 2011 1:50 am
by AnonyMoose
Daniel wrote:i did set it to sort by name a while ago but got complaints from people that they wanted a sort order. now it causes problems.

one way to solve it is to add a sort order for ever product.

Makes sense for small shops, but having to set order for lots of products is a pain and if you remove, add etc. more products it becomes unmanageable since you can't see sort order in products view in Admin, so you'd have to open details for every single one to see what's going on..

Re: 2nd page repeat items

Posted: Tue Nov 15, 2011 8:23 am
by spirit
Daniel wrote:i did set it to sort by name a while ago but got complaints from people that they wanted a sort order. now it causes problems.

one way to solve it is to add a sort order for ever product.
I think that "'p.date_added" is the best way for set as default in OC :)

Re: 2nd page repeat items

Posted: Wed Jan 11, 2012 4:25 pm
by nikosurfing
spirit wrote:Thanks JSSL.

I did this:

Code: Select all

if (isset($this->request->get['sort'])) {
			$sort = $this->request->get['sort'];
		} else {
			$sort = 'p.date_added';
		}

		if (isset($this->request->get['order'])) {
			$order = $this->request->get['order'];
		} else {
			$order = 'DESC';
		}
And in line 128, i did this:

Code: Select all

foreach ($results as $result) {
			$data = array(
			'filter_category_id' => $result['category_id'],
			'filter_sub_category' => true	
			);

			$product_total = $this->model_catalog_product->getTotalProducts($data);
				
				$this->data['categories'][] = array(
					'name'  => $result['name'] . ' (' . $product_total . ')',
					'href'  => $this->url->link('product/category', 'path=' . $this->request->get['path'] . '_' . $result['category_id'] . $url)
				);
			}
Now, categories and sub-categories, work fine (no repeat items in the 2nd and next pages).
Thanks guys.
Hi Spirit & JSSL, im using 1.5.3 and got the same problem. But i modified catagory.php just like you did. And Great! ITS WORKED!
Dont forget to add [PROBLEM SOLVED] on the tittle of your post. Thanks guy ;D
Thanks guy.

Re: 2nd page repeat items

Posted: Wed Jan 11, 2012 9:56 pm
by straightlight

Code: Select all

go to: catelog/controller/product/category.tpl
for:

Code: Select all

go to: catalog/controller/product/category.php
There are no tpl files in controllers.

Re: 2nd page repeat items

Posted: Wed Jan 11, 2012 9:57 pm
by Qphoria
spirit wrote:
Daniel wrote:upgrade.
Thanks, but how can i fix it?
I don't want change my OC version yet (i'm using 1.5.1.1).
Upgrading from 1.5.1.1 to 1.5.1.3 is pretty harmless

Re: 2nd page repeat items

Posted: Tue Mar 06, 2012 6:13 pm
by marogiannis
BRAVO people !!!
Another successfull assitance.

Re: 2nd page repeat items

Posted: Fri Jun 01, 2012 7:49 am
by pxdva
Genius! Thank you for the fix! :)