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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| 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! |
|
#2
| |||
| |||
| |
|
#3
| |||
| |||
| 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. |
|
#4
| |||
| |||
| 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! |
| The Following 2 Users Say Thank You to xtech For This Useful Post: | ||
Autoegocrat (03-02-2007), JeffChandler (04-01-2007) | ||
|
#5
| ||||
| ||||
| 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? |
|
#6
| ||||
| ||||
| Aha... the solution is to remove the ['sort'] bit from the code. + sign disappears, but it's still sorting on the model. Great! |
|
#7
| |||
| |||
| Quote:
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!! |
| Thread Tools | |
| |
| ||||
| 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 |