Post by Goober » Tue Apr 06, 2010 10:16 am

Hi,

There are two issues here.

1. Looking at the Demo site use this link Keyword Search on letter 'a'. Please note that the first four items returned in the search are links to the same item, 'Apply Cinema 30'. This item appears in multiple categories.
Suggestion, return unique items.

2. Using the search results from above, sort the items by price Low > High. Please note item returned in the 8th position. The price of the item is £1,175. This item is between items prices at £100 and and £235.
Not sure what/where the problem is here. But clearly the sort is off.

Thanks!
Love what you've done with the cart.

OpenCart modules and custom programming
Please visit site and store www.opencartmods.com
Demo Site


New member

Posts

Joined
Tue Aug 18, 2009 10:44 am
Location - New York, USA

Post by rph » Tue Apr 06, 2010 11:28 am

It looks like Daniel probably duped the Apple Cinema monitor a bunch of times when testing the new copy function. You'll notice they all have different product IDs. So it's not a bug, just an issue with the demo store (in previous versions a product would have multiple returns if it was in multiple categories; I don't know if that was ever changed).

The Sony VAIO is a good catch. It appears the comma is the issue.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Goober » Tue Apr 06, 2010 9:27 pm

rph wrote:It looks like Daniel probably duped the Apple Cinema monitor a bunch of times when testing the new copy function. You'll notice they all have different product IDs. So it's not a bug, just an issue with the demo store (in previous versions a product would have multiple returns if it was in multiple categories; I don't know if that was ever changed).

The Sony VAIO is a good catch. It appears the comma is the issue.
Yep, you are correct, the dups are the result of over active copy function.

that just leaves the sort by price issue.

thanks
/Goober

OpenCart modules and custom programming
Please visit site and store www.opencartmods.com
Demo Site


New member

Posts

Joined
Tue Aug 18, 2009 10:44 am
Location - New York, USA

Post by dunester » Thu Apr 08, 2010 6:52 am

Having the same pricing issue here.

On low to high $17.95 come before $4.95 - seems to be looking at each number individually i.e. the 1 in $17.95 is lower than the 4 in $4.95 so it gets put first.

Newbie

Posts

Joined
Thu Apr 08, 2010 6:47 am

Post by rph » Thu Apr 08, 2010 7:45 am

Yeah, the problem is the sort is doing everything as strings. Here's a real quick fix for it:

/catalog/model/catalog/product.php
Change:

Code: Select all

			$sort_data = array(
				'pd.name',
				'p.price',
				'rating'
			);	
			
			if (in_array($sort, $sort_data)) {
				$sql .= " ORDER BY LCASE(" . $sort . ")";
			} else {
				$sql .= " ORDER BY LCASE(pd.name)";	
			}
To:

Code: Select all

			$sort_data = array(
				'LCASE(pd.name)',
				'p.price',
				'rating'
			);	
			
			if (in_array($sort, $sort_data)) {
				$sql .= " ORDER BY " . $sort;
			} else {
				$sql .= " ORDER BY LCASE(pd.name)";	
			}

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by Qphoria » Thu Apr 08, 2010 12:25 pm

fixed. thanks.

Image


User avatar
Administrator

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Boekel » Tue Sep 28, 2010 11:26 pm

How to fix this in 1.4.8b?

Newbie

Posts

Joined
Mon Aug 30, 2010 9:38 pm

Post by Boekel » Thu Sep 30, 2010 11:28 pm

bump

Newbie

Posts

Joined
Mon Aug 30, 2010 9:38 pm

Post by ocatfni » Sat Oct 16, 2010 4:09 am

We are running v1.4.8 and I have found the error that doesn't allow for sorting by price.
In that same file (/catalog/model/catalog/product.php), the 'p.price' sort option is missing from the array.

This error occurs in multiple places on this page in functions for sorting by category, manufacturer, tags, keyword, and specials.

BEFORE:

Code: Select all

$sort_data = array(
  'pd.name',
  'p.sort_order',
  'special',
  'rating'
);
AFTER:

Code: Select all

$sort_data = array(
  'pd.name',
  'p.price',
  'p.sort_order',
  'special',
  'rating'
);
I also noticed that 'special' is incorrectly included in the list in most of these functions as well.
The specials info isn't available for sorting because the table is not included in the SQL query.

Newbie

Posts

Joined
Wed Aug 18, 2010 10:43 pm

Post by Boekel » Wed Nov 17, 2010 4:39 pm

dunester wrote:Having the same pricing issue here.

On low to high $17.95 come before $4.95 - seems to be looking at each number individually i.e. the 1 in $17.95 is lower than the 4 in $4.95 so it gets put first.
I have this problem in the backend.
They are sorted like this:

Name:
1.000 stuks
10.000 stuks
100 stuks

but I want to sort them like this:

Name:
100 stuks
1.000 stuks
10.000 stuks

without removing the '.'

Newbie

Posts

Joined
Mon Aug 30, 2010 9:38 pm

Post by wizardhomefitness. » Wed Dec 08, 2010 7:34 pm

ocatfni wrote:We are running v1.4.8 and I have found the error that doesn't allow for sorting by price.
In that same file (/catalog/model/catalog/product.php), the 'p.price' sort option is missing from the array.

This error occurs in multiple places on this page in functions for sorting by category, manufacturer, tags, keyword, and specials.

BEFORE:

Code: Select all

$sort_data = array(
  'pd.name',
  'p.sort_order',
  'special',
  'rating'
);
AFTER:

Code: Select all

$sort_data = array(
  'pd.name',
  'p.price',
  'p.sort_order',
  'special',
  'rating'
);
I also noticed that 'special' is incorrectly included in the list in most of these functions as well.
The specials info isn't available for sorting because the table is not included in the SQL query.
Hi Guys,

I was having the same issue with my products not sort properly by price. I have edited the code as explained above, now it's almost working as it should be but just one product is now out of order?

I'm pretty limited when it comes to editing code etc so I don't want to start messing around with too much, if anyone has any ideas I would appreciate it. As I said the above fix worked to some extent but for some reason one product in still out of order, although there is only around 10 products on the page I was testing.

Thanks,

Pat

Gym Equipment Online Store
http://www.wizardhomefitness.com.au
----------------------------------------------------
Fresh Kicks Online Sneaker & Clothing Store
http://www.freshkicks.com.au


New member

Posts

Joined
Tue Aug 03, 2010 2:53 pm
Who is online

Users browsing this forum: No registered users and 153 guests