Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2023
    Location
    UK
    Posts
    54
    Plugin Contributions
    0

    Default Move Out Of Stock Products To The End Of Pages

    Like to show the out of stock products at the end of pages, and have been achieving this, thanks to a very old post on here from over 10 years ago (details below):

    https://www.zen-cart.com/showthread....ists-how-to-do

    For some reason I can't seem to get this to work, using the current default_filter.php file from the latest version of Zencart V2.1.0 which can be found under:

    includes > index_filters > default_filter.php

    Added the following line of code to line 111, in version 2.1.0 default_filter.php file:

    $order_by .= " order by IF( p.products_quantity >0, 1, 0 ) DESC , p.products_sort_order , pd.products_name";

    Had to revert to the older default_filter.php file from Zencart V1.5.8a, to be able to show the out of stock products at the end of pages in version 2.1.0, using the suggestion from this old post on here.

    Not sure if anyone has any suggestions for the best way to achieve this, using the latest default_filter.php file?

    Kind Regards,

    Andy
    Last edited by andy_77; 23 Feb 2025 at 06:30 PM.

  2. #2
    Join Date
    Apr 2009
    Posts
    468
    Plugin Contributions
    2

    Default Re: Move Out Of Stock Products To The End Of Pages

    You will also need to modify all the order by statements on lines 124-142 inclusive.

    A better alternative would be to crate an observer to use the notifier 'NOTIFY_PRODUCT_LISTING_QUERY_STRING' and modify the order by clause in that. see https://docs.zen-cart.com/dev/code/notifiers/ for details.

    If you do this you will not have to change the core files and save yourself the rewrite every time you upgrage zen cart.
    Mark Brittain
    http:\\innerlightcrystals.co.uk\sales\

  3. #3
    Join Date
    Apr 2023
    Location
    UK
    Posts
    54
    Plugin Contributions
    0

    Default Re: Move Out Of Stock Products To The End Of Pages

    Thanks brittainmark,

    Kind Regards,

    Andy

 

 

Similar Threads

  1. v155 Take out of stock from catalog (front-end) *inventory taking cheats* :D
    By wolfderby in forum Contribution-Writing Guidelines
    Replies: 8
    Last Post: 3 Apr 2017, 08:31 PM
  2. Replies: 0
    Last Post: 16 Nov 2012, 04:36 PM
  3. v150 Out of stock items in the end of lists - how to do?
    By rafcamera in forum Templates, Stylesheets, Page Layout
    Replies: 19
    Last Post: 5 Mar 2012, 12:27 PM
  4. move sold out items to end of category listing
    By tbrides in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 15 Feb 2010, 03:34 PM
  5. I can't figure out how to move products from the top level category
    By pmarble in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 9 Dec 2009, 09:36 AM

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