Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

sort by date?


gon11

Recommended Posts

Is it possible to show and be able to sort product listing by date? Because is kind of confussing if they all get sorted by manufature or product name since I have about 30 new items every month. I want it to show when it was added and also the choice of sorting by Manufacture, Name or Date.

 

thanks

Link to comment
Share on other sites

Yes,- - you will have to add p.products_date_added to the database queries in index.php - then change the following:

 

    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";

         break;

       }

     }

 

to:

 

    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 p.products_date_added";

         break;

       }

     }

 

If you want "Date Added" to display in the listing, then you will have to add it in the same manner as the other attributes - this involves quite some work on index.php, product_listing.php, english.php and the configuration table in your database

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...