Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Sort Order


scrapkats

Recommended Posts

Posted

Hi

 

Can anyone please tell me what am I supposed to put in the sort order box in the catalog categories?

I would like newest products to appear first or do they go in alphabetically?

 

Thank you

Kat

"Life is short, break the rules, forgive quickly, kiss slowly, love truly, laugh uncontrollably, and never regret anything that made you smile."

Posted

Te sort order entry for the categories determines the order of the categories. It doesn't change the products order. Those are sorted alphabetically unless the code is changed to alter that.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Posted

here is a way so that you can have certain categories go by product id and if they are not in the list then they go by name

 

 

this was my way but I am sure there are many different and better ways....

 

index.php in your home folder look for this (first few lines)...........

 

    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 . 'b';

   //      $listing_sql .= " order by pd.products_id";
                switch ($HTTP_GET_VARS['cPath']) {    //$HTTP_GET_VARS['cPath']? SORT DEPENDING ON WHICH CATEGORY!!!!!!!!!!!!!
                 case "32_35":
                 case "32_36":
                 case "32_37":
                 case "32_38":
                 case "32_38_54_99":


                    $listing_sql .= " order by pd.products_id";
                    break;
                 default:
                    $listing_sql .= " order by pd.products_name";
                 }



         break;
       }
     }
   }
   else {
     $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1);
     $sort_order = substr($HTTP_GET_VARS['sort'], 1);
     $listing_sql .= ' order by ';
     switch ($column_list[$sort_col-1]) {
       case 'PRODUCT_LIST_MODEL':
         $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_NAME':
         $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : '');
         break;
       case 'PRODUCT_LIST_MANUFACTURER':
         $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_QUANTITY':
         $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_IMAGE':
         $listing_sql .= "pd.products_name";
         break;
       case 'PRODUCT_LIST_WEIGHT':
         $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
       case 'PRODUCT_LIST_PRICE':
         $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name";
         break;
     }
   }

Archived

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

×
×
  • Create New...