Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Product's sorting order


uglukha

Recommended Posts

Posted

Hello all,

I have another problem, I have very small store so I decided to use contribution - http://addons.oscommerce.com/info/6996 - Product Listing on the Front Page. It does exaclty what it supposed to do, lists all products on the front page.

 

But it sorting products in alphabetical order. Any idea how I can change it to full customization type of sorting. For example:

 

I have:

- product A

- product B

- product C

- product D

 

And I would have them showing them on page in this order:

- product C

- product B

- product D

- product A

 

Kind regards,

any help appreciated,

thx

            _       _    _           
           | |     | |  | |          
_   _  __ _| |_   _| | _| |__   __ _ 
| | | |/ _` | | | | | |/ / '_ \ / _` |
| |_| | (_| | | |_| |   <| | | | (_| |
\__,_|\__, |_|\__,_|_|\_\_| |_|\__,_|
       __/ |                         
      |___/  

Posted

Hello all,

I have another problem, I have very small store so I decided to use contribution - http://addons.oscommerce.com/info/6996 - Product Listing on the Front Page. It does exaclty what it supposed to do, lists all products on the front page.

 

But it sorting products in alphabetical order. Any idea how I can change it to full customization type of sorting. For example:

 

I have:

- product A

- product B

- product C

- product D

 

And I would have them showing them on page in this order:

- product C

- product B

- product D

- product A

 

Kind regards,

any help appreciated,

thx

 

 

I delt with sorting in this thread http://www.oscommerce.com/forums/index.php?showtopic=308798&hl= and use the product sort order in admin to set order

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Posted

thx, thats great, your topic helped me a lot! :)

 

If anyone need that solution I will write here what i did:

 

I changed sorting to sorting by weight (i wasnt using it), so as weight i put number of product I want to on top (1 is top, 2 is next, 3 is next etc...)

 

to do this need edit index.php (with contribution I used u need do as following):

 

Find

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

and change to

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

 

and change

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

to

$listing_sql .= " order by p.products_weight";

 

u need make those 2 changes in 2 lines - around 360 and 190

 

Remember to activate showing "weight" column in admin panel.

 

Also you can change name of column from "weight" to "number", it is in include/languages/YOUR LANGUAGE/index.php around line 29

  define('TABLE_HEADING_WEIGHT', 'Number');

 

Also you can change displaying name of "product weight" to "product number" or whatever in admin panel. Just open admin/includes/languages/YOUR LANGUAGE/categories.php and change to this (around line 89):

define('TEXT_PRODUCTS_WEIGHT', 'Product Number:');

 

Thats all.

 

P.S. I have another question, how to change format of weight, it displays as "1.00", "2.00" . I would like to change it to "1", "2" etc.

            _       _    _           
           | |     | |  | |          
_   _  __ _| |_   _| | _| |__   __ _ 
| | | |/ _` | | | | | |/ / '_ \ / _` |
| |_| | (_| | | |_| |   <| | | | (_| |
\__,_|\__, |_|\__,_|_|\_\_| |_|\__,_|
       __/ |                         
      |___/  

  • 3 weeks later...
Posted

This is a great idea for a simple solution if your implementation is simple enough.

 

One thing I would like to add however is that you don't need to display the weight column if you don't want to and get the annoying "1.00" listed next to each product.

 

Instead of changing both lines, just change the second one.

 

Basically DON'T DO this:

Find

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

and change to

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

 

But DO THIS:

and change

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

to

$listing_sql .= " order by p.products_weight";

 

Thus, you're saying that if the Product Name column is displayed, then use weight to sort. The nice thing is that this doesn't require you to turn on the Weight column and you can do all this in the background!

 

Again, thanks for the great tip!

 

kevin

 

 

thx, thats great, your topic helped me a lot! :)

 

If anyone need that solution I will write here what i did:

 

I changed sorting to sorting by weight (i wasnt using it), so as weight i put number of product I want to on top (1 is top, 2 is next, 3 is next etc...)

 

to do this need edit index.php (with contribution I used u need do as following):

 

Find

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

and change to

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

 

and change

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

to

$listing_sql .= " order by p.products_weight";

 

u need make those 2 changes in 2 lines - around 360 and 190

 

Remember to activate showing "weight" column in admin panel.

 

Also you can change name of column from "weight" to "number", it is in include/languages/YOUR LANGUAGE/index.php around line 29

  define('TABLE_HEADING_WEIGHT', 'Number');

 

Also you can change displaying name of "product weight" to "product number" or whatever in admin panel. Just open admin/includes/languages/YOUR LANGUAGE/categories.php and change to this (around line 89):

define('TEXT_PRODUCTS_WEIGHT', 'Product Number:');

 

Thats all.

 

P.S. I have another question, how to change format of weight, it displays as "1.00", "2.00" . I would like to change it to "1", "2" etc.

Posted

 

Thus, you're saying that if the Product Name column is displayed, then use weight to sort. The nice thing is that this doesn't require you to turn on the Weight column and you can do all this in the background!

 

 

 

Er, slight problem with that, it means when the visitor changes the sort order & selects sort by name, he gets smthg else!! Might make them think your site is broke a bit!

 

The original thread details changing the default, I`d advise against changing anything else.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Archived

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

×
×
  • Create New...