Results 1 to 3 of 3
  1. #1
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Auto set sort order when products out of stock?

    Hi All,

    I use sort orders to place products in the order that I want them, however, it would be nice if before using the sort order I choose, it sent all out of stock products to the end, then all in stock products to use my specified sort orders at the front.

    I read a thread where someone had done something similar, however they simply set in stock at the front and out of stock at the back.

    I want the in stock items to still use the sort orders I specify and out of stock items to over-ride the sort I set to like 1000??

    Anyone know how I can achieve this/done this before?

    Cheers
    Phil

  2. #2
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Auto set sort order when products out of stock?

    following the post I found, so far I have set

    $listing_sql .= " order by p.products_sort_order , pd.products_name";

    to

    $listing_sql .= " order by p.products_sort_order , p.products_quantity desc";

    in /includes/index_filters/default_filter.php

    Now although this works, Here is an example why its not..

    prod1 - instock - sort 0
    prod2 - instock - sort 5
    prod3 - outstock - sort 0
    prod4 - outstock - sort 5

    here is how the current set up orders them:
    prod1 - instock - sort 0
    prod3 - outstock - sort 0
    prod2 - instock - sort 5
    prod4 - outstock - sort 5

    I need it to sort like this:
    prod1 - instock - sort 0
    prod2 - instock - sort 5
    prod3 - outstock - sort 0
    prod4 - outstock - sort 5

    Any suggestions how to get it to do what I want??

  3. #3
    Join Date
    Aug 2009
    Location
    Bedford, England
    Posts
    966
    Plugin Contributions
    0

    Default Re: Auto set sort order when products out of stock?

    haha I think I worked it out

    assuming im right

    i've just swapped which it sorts by first..

    so I now have
    $listing_sql .= " order by p.products_quantity desc, p.products_sort_order";

    instead of

    $listing_sql .= " order by p.products_sort_order, p.products_quantity desc";

    Is that right??

    also can I add more rules to it?

    like

    name, sort, quantity..

    ??

 

 

Similar Threads

  1. Replies: 3
    Last Post: 17 Jan 2012, 08:20 AM
  2. Replies: 7
    Last Post: 10 Jun 2010, 10:43 AM
  3. Where do i globally set products sort order?
    By this side up in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 24 May 2007, 06:58 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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR