I have set up a sort box in the product listing pages to add the &sort= , When I sort by price 3d or 3a it works fine. I set up some custom fields in the product table and added them to the sort box (eg 8a, 9) following the existing format.
The new &sort=x is displaying fine in the url string, and I changed the default filter to have new case statements (keeping the format of the existing ones)
case 'PRODUCT_LIST_WEIGHT':
$listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
break;
case 'PRODUCT_LIST_NEWVAR':
$listing_sql .= "p.products_newvar" . ($sort_order == 'd' ? 'desc' : '');
break;
but the box defaults back to -reset- and the products are not sorted.
My custom fields display fine on the products page in the listings themselves, and I added the new fields to pretty much every sql select statement I could find in the includes directory. but still no sorting.
Where is the &sort= parsed and order by created if not in the default filter file? I have to think, I need to change something in the defaultfilter file ... maybe around:
if (isset($column_list)) {
if ((!isset($_GET['sort'])) || (isset($_GET['sort']) && !ereg('[1-8][ad]', $_GET['sort'])) || (substr($_GET['sort'], 0, 1) > sizeof($column_list)) ) {
for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
if (isset($column_list[$i]) && $column_list[$i] == 'PRODUCT_LIST_NAME') {
$_GET['sort'] = $i+1 . 'a';
$listing_sql .= " order by p.products_sort_order, pd.products_name";
break;
I have this working for my all / new / featured products, but I know that uses a different sorting technique ( this is why I changed the search box to amend the url string)
Any input is appreciated!



