Latest Product Sort Order bug

Description

When you go to the “latest Products” page and try to use the sort order drop down option nothing happens. The products remain in the same order no matter what you choose A-Z, low-high and so on.

The feature does work on all the other pages specials, any category with multiple items and will sort them correctly

The issue seems to be only on the “Latest Products” page

Environment

Operating System: w-7

Steps to reproduce

Click right arrow at top of what's new info box

Choose any option in the dropdown box "Sort Order"

>Nothing Happens<

should sort by the option choosen

Activity

Show:
Giles Marshall
September 1, 2013, 6:14 AM

This is a bug ... although we need to think about how to fix this.

The product_date_added overpowers all the other sorts ... it needs to be moved into the main switch to work properly (which may be quite complicated)

John Robertson
November 4, 2016, 7:40 AM
Edited

As near as I can tell the error was introduced in /catalog/index.php for 2.5.3.

The differences between 2.5.3 and 2.5.2 are:

2.5.3 and 2.5.4: (around line 346)
PHP Code:
$listing_sql .= " order by " . $new_products_sort . "p.products_model" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_NAME':
$listing_sql .= " order by " . $new_products_sort . "pd.products_name" . ($sort_order == 'd' ? ' desc' : '');
break;
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= " order by " . $new_products_sort . "m.manufacturers_name" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_QUANTITY':
$listing_sql .= " order by " . $new_products_sort . "p.products_quantity" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_IMAGE':
$listing_sql .= " order by " . $new_products_sort . "pd.products_name";
break;
case 'PRODUCT_LIST_WEIGHT':
$listing_sql .= " order by " . $new_products_sort . "p.products_weight" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_PRICE':
$listing_sql .= " order by " . $new_products_sort . "final_price" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_BESTSELLER':
$listing_sql .= " order by " . $new_products_sort . "p.products_ordered" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;

and the original 2.5.2 code (around line 346):

PHP Code:
$listing_sql .= " order by p.products_model" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_NAME':
$listing_sql .= " order by pd.products_name" . ($sort_order == 'd' ? ' desc' : '');
break;
case 'PRODUCT_LIST_MANUFACTURER':
$listing_sql .= " order by m.manufacturers_name" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_QUANTITY':
$listing_sql .= " order by p.products_quantity" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_IMAGE':
$listing_sql .= " order by pd.products_name";
break;
case 'PRODUCT_LIST_WEIGHT':
$listing_sql .= " order by p.products_weight" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_PRICE':
$listing_sql .= " order by final_price" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_BESTSELLER':
$listing_sql .= " order by products_ordered" . ($sort_order == 'd' ? ' desc' : '') . ", pd.products_name";
break;
The actual code added to these lines is "* . $new_products_sort . *" which can be safely removed as far as I can tell. Certianly my New Products sorts work fine with the extra bits removed. You do not remove the earlier three $new_products_sort of course, just the ones above.

This code was added in 2.5.3 full and upgrade versions of osCmax. This seems to be the cause of the problem...

Assignee

Michael Sasek

Reporter

Roy Randolph

Labels

None

Severity

Minor

Components

Affects versions

Priority

Configure