Results 1 to 7 of 7

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 ...

      
  1. #1
    New Member
    Join Date
    Mar 2004
    Posts
    20
    Rep Power
    0


    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!

  2. #2
    Member
    Join Date
    Jan 2004
    Posts
    86
    Rep Power
    0


    Default

    Hello,
    Here you go. Hope this helps. http://www.oscdox.com/index.php?name...highlight=sort

  3. #3
    New Member
    Join Date
    Mar 2004
    Posts
    20
    Rep Power
    0


    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.

  4. #4
    New Member
    Join Date
    Mar 2004
    Posts
    20
    Rep Power
    0


    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!

  5. #5
    New Member rogerj30's Avatar
    Join Date
    Aug 2004
    Posts
    6
    Rep Power
    0


    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?

  6. #6
    New Member rogerj30's Avatar
    Join Date
    Aug 2004
    Posts
    6
    Rep Power
    0


    Default

    Aha... the solution is to remove the ['sort'] bit from the code. + sign disappears, but it's still sorting on the model. Great!

  7. #7
    New Member
    Join Date
    Apr 2005
    Posts
    14
    Rep Power
    0


    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:

    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!!

Similar Threads

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •