Post by spirit » Sun Oct 16, 2011 2:17 am

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.

Active Member

Posts

Joined
Sat Oct 02, 2010 7:40 am

Post by Daniel » Mon Oct 17, 2011 9:14 am

upgrade.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by spirit » Tue Oct 25, 2011 2:12 pm

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).

Active Member

Posts

Joined
Sat Oct 02, 2010 7:40 am

Post by Daniel » Wed Oct 26, 2011 1:33 pm

search the svn.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by JSSL » Wed Oct 26, 2011 7:05 pm

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.

New member

Posts

Joined
Tue Oct 25, 2011 4:49 pm

Post by spirit » Thu Oct 27, 2011 12:34 am

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.

Active Member

Posts

Joined
Sat Oct 02, 2010 7:40 am

Post by AnonyMoose » Mon Nov 07, 2011 11:48 pm

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.

New member

Posts

Joined
Wed Jul 20, 2011 5:35 pm

Post by Daniel » Tue Nov 08, 2011 12:29 am

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.

OpenCart®
Project Owner & Developer.


User avatar
Administrator

Posts

Joined
Fri Nov 03, 2006 6:57 pm

Post by AnonyMoose » Tue Nov 08, 2011 1:50 am

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..

New member

Posts

Joined
Wed Jul 20, 2011 5:35 pm

Post by spirit » Tue Nov 15, 2011 8:23 am

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 :)

Active Member

Posts

Joined
Sat Oct 02, 2010 7:40 am

Post by nikosurfing » Wed Jan 11, 2012 4:25 pm

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.

Newbie

Posts

Joined
Tue Nov 01, 2011 9:31 am

Post by straightlight » Wed Jan 11, 2012 9:56 pm

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.

Dedication and passion goes to those who are able to push and merge a project.

Regards,
Straightlight
Programmer / Opencart Tester


Legendary Member

Posts

Joined
Mon Nov 14, 2011 11:38 pm
Location - Canada, ON

Post by Qphoria » Wed Jan 11, 2012 9:57 pm

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

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Newbie

Posts

Joined
Thu Jan 28, 2010 3:18 am


Post by pxdva » Fri Jun 01, 2012 7:49 am

Genius! Thank you for the fix! :)

Newbie

Posts

Joined
Thu Aug 04, 2011 6:20 am
Who is online

Users browsing this forum: No registered users and 16 guests