Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Simple Product Listing Question


updmike

Recommended Posts

I have no idea what happened there, I did type something.. LOL.. anyway, here it goes again..

 

I am looking for a simple way to reverse the default product listings sort order on the site. I dont need any fancy contribution to sort products, just reverse the way the come in a clean instal.

 

Hope someone can help.. Thanks..

 

Mikey

Link to comment
Share on other sites

my products are video tapes and the titles are given by years.

 

curently they are being listed 2001,2002,2003,2004

 

so I guess that is ascending. I would like them to descend by title or product Title so they appear 2004,2003,2002,2001

 

Hope ya can help..

 

thanks..

 

Mikey

Link to comment
Share on other sites

  • 2 weeks later...

fiat707 Posted on Dec 9 2003, 12:55 AM

"You could try putting "desc" after products_name. "

 

We too have video tapes and DVDs on our site and have the same request for likely the same reason, we want customers to first see the very latest tape we offer, not the one we created 7 years ago.

 

Hence, on which file/page (or line number) does this modification need to take place? We're new to this but quite willing to root around . . . but are not familiar enough with the architecture of OSCommerce to know where to look to modify this. Many thanks in advance.

 

Happy Holidays to one and all!

 

John

John Beech - GM (and janitor)

Link to comment
Share on other sites

In catalog/index.php - here is the line with the sort order you should edit:

 

        if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by pd.products_name";
         break;

 

eg.

 

        if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
         $HTTP_GET_VARS['sort'] = $i+1 . 'a';
         $listing_sql .= " order by p.products_model desc";
         break;

 

Matti

Link to comment
Share on other sites

Same code, change the a in the second line to a d, as follows:

        if ($column_list[$i] == 'PRODUCT_LIST_NAME') {
        $HTTP_GET_VARS['sort'] = $i+1 . 'd';
        $listing_sql .= " order by pd.products_name desc";
        break;

I'm not sure if you needed the change of columns in the third line as well? If you did, you might also want to change the first line to match, then it would look like this:

        if ($column_list[$i] == 'PRODUCT_LIST_MODEL') {
        $HTTP_GET_VARS['sort'] = $i+1 . 'd';
        $listing_sql .= " order by p.products_model desc";
        break;

Hth,

Matt

Link to comment
Share on other sites

Tom, it looks like your settings in admin > Configuration > Product Listing are wrong. That area allows you to configure what columns you have in your product listing.

 

Hth,

Matt

Link to comment
Share on other sites

Using phpMyAdmin or another database tool, check to see if the configuration values for your product listing match the ones for which it is looking in includes/modules/product_listing.php. I.e. compare the configuration_key from the database to what is appearing in the case 'PRODUCT_LIST_MODEL': and other such lines in the file. If not, change to match.

 

Hth,

Matt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...