Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How can I rearrange the order of the products?


eruth

Recommended Posts

Posted

Let's say I have the products:

 

Apple

Bread

Cheese

Doughnut

 

but I want the products to appear as:

 

Doughnut

Bread

Apple

Cheese

 

How can I arrange the order of the products so that it's not alphabetical?

My only solution thus far, which looks tacky, is to have:

 

A1 Doughnut

A2 Bread

A3 Apple

A4 Cheese

 

But that prefix looks ridiculous. Please, any response any one can give

me will be greatly appreciated.

Posted

Hey, Erich. I have the same need as you do. I was adding all products in an order I want to display the products, but it came up with the alphabetical order as you mentioned. I checked the product ID numbers and found the id numbers followed in the order I added the products. So the idea is to set it to display products in the order of product id#. But, I don't know how and where to set it up. Hope there are other people here can help on this.

 

KF

Posted

Hey, I got the solution for this one! If you can set the order of your product_id (the order you add your products into a category) to be the order you want to display, you can go to catalog/index.php and change the following code:

 

if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by pd.products_name";

break;

 

to:

 

if ($column_list[$i] == 'PRODUCT_LIST_NAME') {

$HTTP_GET_VARS['sort'] = $i+1 . 'a';

$listing_sql .= " order by pd.products_id asc";

break;

 

You can get it to display products in order you like. You can also sort in the order of product price if you like.

 

Good luck (I got this help from Matti Ressler of this forum member.)

Posted

yes, fiat707's solution might work just fine for awhile, but it would lead to minor problems in the future. you then would have to deal with MySQL data and change the products_id number everytime you want to change the order of products.

 

my suggestion is to alter the products table and add another column to hold a number for priority/order and then the index.php code to list the products order by that column.

Posted

I like the idea of creating a second column. I'll pursue that method.

Hopefully, I can find a solution on that wiki OsCommerce forum.

 

Something like:

 

Product Item Product Name

A101 Apple

A150 Bread

...

Posted

oh one more thing, if you pursue my method, you have to add another text box to accomodate the priority number, and add another variable/parameter in your insert into statements and update table statements in your admin/categories.php file. it's messy but it can be done.

 

fiat707's method is actually not any different than mine but i think mine is more scalable and more robust and you don't have to change the priority numbers in phpmyadmin but instead you can edit them directly in osc admin.

  • 3 weeks later...
Posted

Where do you type in the ID number for a product?

 

Please let me know. This part I don't understand.

Archived

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

×
×
  • Create New...