Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Various Product Sort Order Possibility?


locaincb

Recommended Posts

I am trying to sort some products based on products_name and other products based on a custom field I added called products_date. (The products with dates are actually classes/events and I would like them to be displayed together, rather than by name) FYI products_date is not a date field but a varchar field in the db.

 

So I get to this part of the index.php file (@ line 210)

 

 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_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name desc";
         break;
       }
     }
   }

 

but I am stuck (i didn't get very far)!!

 

basically I would like to say : if current_category_id != XX then $listing_sql .= "order by pd.products_date asc" but I am not exactly sure what the for loop is doing in the code I posted above and dont know if I need it ??? has anyone ever done this ??? Just need a little direction if you have it. Thanks!

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...