osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

Product Sort Order

This is a discussion on Product Sort Order within the osCMax v1.7 Discussion forums, part of the osCMax v1.7 Forums category; Hi All, Does anyone know how to change the product sort order. I've got products that are named: Product 3 ...


Go Back   osCommerce and osCMax shopping cart software forums > osCMax v1.7 Forums > osCMax v1.7 Discussion

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 03-31-2004, 02:06 PM
New Member
 
Join Date: Mar 2004
Posts: 20
Thanks: 0
Thanked 2 Times in 1 Post
Rep Power: 0
xtech
Default Product Sort Order

Hi All,

Does anyone know how to change the product sort order.
I've got products that are named:
Product 3 lb
Product 5 lb
Product 10 lb

Ideally, I'd like them to be sorted in that order. Since product lists within a category are being sorted by product name, and since the "1" in "10lb" is a lesser value than the "3" in 3 lb, the sort order is goofy:

Product 10 lb
Product 3 lb
Product 5 lb

I've seen a couple of posts asking similar questions, but thought I'd try it again. I'm a newbie to PHP, but I'm learning a lot of things, and don't mind poking around. I'm just a bit lost. I've looked in:

templates/index_products.tpl.php and seen the reference to
includes/modules/product_listing_col.php

I've looked there and in product_listing.php, but am not experienced enough to see where the product sort is taking place.

I'm going to check out the product sort contrib for OSC. I tried to update the database with the .sql file that's part of the contrib last night, and met with errors. I put everything back and am going to try looking through the file to see if I can make sense of it.

Just thought I'd check first to see if anyone else has had any success.

If anyone's interested I'll post the results (Assuming I can get anywhere)

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #2  
Old 03-31-2004, 05:46 PM
Member
 
Join Date: Jan 2004
Posts: 86
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
auntie22
Default

Hello,
Here you go. Hope this helps. http://www.oscdox.com/index.php?name...highlight=sort
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 04-01-2004, 04:17 AM
New Member
 
Join Date: Mar 2004
Posts: 20
Thanks: 0
Thanked 2 Times in 1 Post
Rep Power: 0
xtech
Default

Hi auntie22 (who are the other 21 aunties?)

I should have been more clear. I'm not trying to sort the product attributes, but the products themselves. Using the attributes for price isn't the way I chose to go. Instead, I've got a category for each product. Within the categories, I'm trying to sort the products by something other than the name. The name contains the product weight, and that's causing the alpha sort to get goofed up. The price would be a nice easy way of sorting.

I know it's probably goofy to do it that way, but the result is that the visitor selects a product (category) sees a description and then a couple of "Buy Now" entries. They aren't required to select a drop down, etc. It seemed easier for them. I also don't want to monkey with the product name in order to artificially create a proper product listing.

Thanks for the help, but I think I'm going to have to dig a bit more. It may be that I'm just trying to do something silly, and I'll have to change things.

Thanks again for the info.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 04-01-2004, 04:56 AM
New Member
 
Join Date: Mar 2004
Posts: 20
Thanks: 0
Thanked 2 Times in 1 Post
Rep Power: 0
xtech
Default

Woo hoo!

In looking at the Product Sort Contrib, it became clear that the sort order can be changed in catalog/index.php.

Around line 119 or so, you can find the following line:

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

The last line
$listing_sql .= " order by p.products_price";

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

Some other things you ought to be able to sort by:

p.products_id
p.products_weight
p.products_model
p.products_price

Hope this helps someone else!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
The Following 2 Users Say Thank You to xtech For This Useful Post:
Autoegocrat (03-02-2007), JeffChandler (04-01-2007)
  #5  
Old 08-06-2004, 07:37 PM
rogerj30's Avatar
New Member
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
rogerj30
Default

I thought for a moment it didn't work, as the + sign remains behind the product name but when I look at the listing it is actually in order on the products model, which is what I wanted. Fab! Thanks! Still wonder about that + sign though... that's a tad odd... anybody have an idea about that? Maybe even how to get rid of it all together?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #6  
Old 08-07-2004, 03:09 AM
rogerj30's Avatar
New Member
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
rogerj30
Default

Aha... the solution is to remove the ['sort'] bit from the code. + sign disappears, but it's still sorting on the model. Great!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #7  
Old 04-08-2005, 07:49 AM
New Member
 
Join Date: Apr 2005
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
moreduff
Default

Quote:
Woo hoo!

In looking at the Product Sort Contrib, it became clear that the sort order can be changed in catalog/index.php.

Around line 119 or so, you can find the following line:

Cheers for that, been trying to sort it for a bit now. Originally tried it and trashed the page, didn't read it properly... duh!! entered pd.products_price, didn't see that you has to selete the "d". Cheers!!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Anyone use Product Attributes Sort Order? illumn8r osCMax v2 Customization/Mods 3 08-01-2006 05:36 AM
Product Sort Order davem osCMax v2 Customization/Mods 4 05-21-2006 04:33 PM
sort order to pot!! moreduff osCMax v1.7 Discussion 0 04-12-2005 04:57 AM
Change sort order on new products Lord osCommerce 2.2 Modification Help 2 03-23-2005 03:05 AM
Setting Sort Order for Products? sheikyerbouti osCommerce 2.2 Installation Help 6 11-12-2003 11:25 PM


All times are GMT -8. The time now is 01:01 AM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax