Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sorting order


scud

Recommended Posts

Posted

Although I have managed to change the sorting attribute of the product listing when the appropriate category is selected, the asc or desc order seems to not be functioning properly. What I need is sorting by manufacturer in descending order... and here is the code

 

    if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
     for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
       if ($column_list[$i] == 'PRODUCT_LIST_MANUFACTURER') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'd';
         $listing_sql .= " order by m.manufacturers_name";
         break;
       }
     }
   } else {

 

Here is the site

Posted

not sure really but could try:

 

if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) {
? ? for ($i=0, $n=sizeof($column_list); $i<$n; $i++) {
? ? ? if ($column_list[$i] == 'PRODUCT_LIST_MANUFACTURER') {
? ? ? ? $HTTP_GET_VARS['sort'] = $i+1 . 'd';
? ? ? ? $listing_sql .= " order by m.manufacturers_name desc";
? ? ? ? break;
? ? ? }
? ? }
? } else {

 

line amended: $listing_sql .= " order by m.manufacturers_name desc";

Your online success is Paramount.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...