Jump to content
Sign in to follow this  

Product Sort Order?

Recommended Posts



Does anyone have a way to sort products displayed in a page, based on products weight?


We'll be using free shipping so could use the weight field to dictate sort order, but what code to change?


any ideas?





Edited by burt
spam link

Share this post

Link to post
Share on other sites

If you want to show/list the products in the product_listing by products_weight then look for this following code inside the index.php around line 162


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


and change it to


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


or if you want to list the heaviest products first then change it to this


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


if you want that the customer is able to sort the products by weight then activate the Display Products Weight function in the admin area.

Admin Area -> Configuration -> Product Listing

Share this post

Link to post
Share on other sites

Hi I have already posted this question on /topic/398903-new-to-oscommerce-need-help/ but it is probably appropriate here as well .....



"Hi, I am new to osC and a total novice with php.


I have been wading thru the convoluted osc code (to me that is - probably not for a seasoned programmer) trying to figure out how to add an entry box (in product add/edit in admin) along with the apro database field and supporting code, to add a sort order to products as per the sort order for categories.


I realise that you can click on price and description fsoa, to change sort and reverse sort order.


 I looked at (what I could decipher) the code for the category sort to try to copy it, but got totally stymied.


I figure it is probably a very simple mod for someone that knows what they are doing, can anyone help or at least point me in the right direction.


Thanks :)"


I read the above post and it sort of heads in the right direction, but it need a field in tha database to establish the sort on and a method in admin to enter that data for each product i.e numbering say 1000 thru 999999 fsok.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this