PDA

View Full Version : Custom sort order field for products in admin/categories.php



michael_s
05-21-2011, 10:29 PM
After installing this contribution, i received an error in the catalog product listing when attempting to go to page 2, 3, etc. of the product listing. Sorry up front if this was supposed to go into a support thread. Hope this helps.

Error:
1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'p.products_sort_order , pd.products_name asc' at line 1

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials_retail_prices s on p.products_id = s.products_id, products_to_categories p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '22'p.products_sort_order , pd.products_name asc

File to Correct: catalog/index.php
Code from original instructions:
Line 218

After

switch ($column_list[$sort_col-1]) {

Add

//sort order
case 'PRODUCT_LIST_SORT_ORDER':
$listing_sql .= "p.products_sort_order , pd.products_name " . ($sort_order == 'a' ? 'asc' : '');
break;
//end sort order

Updated Code (added "order by"):
//sort order
case 'PRODUCT_LIST_SORT_ORDER':
$listing_sql .= " order by p.products_sort_order , pd.products_name " . ($sort_order == 'a' ? 'asc' : '');
break;
//end sort order

More... (http://addons.oscommerce.com/info/2541)