Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2005
    Location
    Captain Cook, Hawaii
    Posts
    179
    Plugin Contributions
    0

    Default Hide Disabled Products from "All Products sidebar search"

    I want to hide disabled products and disabled categories from the "ALL PRODUCTS", "NEW PRODUCTS" links.

    I saw somewhat similar requests on previous versions but have not found a 1.5.1 fix.

    For ALL PRODUCTS I believe the correct file is /includes/modules/pages/products_all/header_php.php and that "WHERE p.products_status = 1" might be the magic phrase.

    Should the SELECT be modified or the following "needs a better check v1.3.1" section?

    If the latter, don't I need to pull the "p.products_status" also in the select?

    I have tried a few tests and have not found the right way to do this. Can you paste in the correct code for me?
    Aloha from Hawaii! (its a dirty job, but SOMEBODY has to live here...)

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,642
    Plugin Contributions
    88

    Default Re: Hide Disabled Products from "All Products sidebar search"

    Did you upgrade from a previous Zen Cart version? Looking at the ZC v1.5.1 distribution version of /includes/modules/pages/products_all/header_php.php, the query is already restricted to only those products that are enabled, i.e. products_status = 1:
    Code:
      $products_all_query_raw = "SELECT p.products_type, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id,
                                        p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight, p.product_is_call,
                                        p.product_is_always_free_shipping, p.products_qty_box_status,
                                        p.master_categories_id
                                 FROM " . TABLE_PRODUCTS . " p
                                 LEFT JOIN " . TABLE_MANUFACTURERS . " m ON (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd
                                 WHERE p.products_status = 1
                                 AND p.products_id = pd.products_id
                                 AND pd.language_id = :languageID " . $order_by;
    You might try using a file-comparison tool like WinMerge or Beyond Compare to see what's different between your files and the "stock" v1.5.1 version. The products_new page default header_php.php file also contains the "enabled products only" distinction in its SQL query.

  3. #3
    Join Date
    Feb 2005
    Location
    Captain Cook, Hawaii
    Posts
    179
    Plugin Contributions
    0

    Default Re: Hide Disabled Products from "All Products sidebar search"

    I believe the WHERE has to be in the SELECT .

    This is a 1.5.1 install not an upgrade and I even downloaded the package again to grab the latest file.

    I have a disabled product in a disabled category and it shows up in the ALL PRODUCTS with the 1.5.1. file as supplied.

    The select being used is:

    * products_all header_php.php
    *
    * @package page
    * @copyright Copyright 2003-2007 Zen Cart Development Team
    * @copyright Portions Copyright 2003 osCommerce
    * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    * @version $Id: header_php.php 6912 2007-09-02 02:23:45Z drbyte $

    .
    .


    $products_all_query_raw = "SELECT p.products_type, p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id,
    p.products_date_added, m.manufacturers_name, p.products_model, p.products_quantity, p.products_weight, p.product_is_call,
    p.product_is_always_free_shipping, p.products_qty_box_status,
    p.master_categories_id
    FROM " . TABLE_PRODUCTS . " p
    LEFT JOIN " . TABLE_MANUFACTURERS . " m ON (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd
    WHERE p.products_status = 1
    AND p.products_id = pd.products_id
    AND pd.language_id = :languageID " . $order_by;
    Last edited by mshultise; 23 May 2014 at 09:32 PM.
    Aloha from Hawaii! (its a dirty job, but SOMEBODY has to live here...)

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,642
    Plugin Contributions
    88

    Default Re: Hide Disabled Products from "All Products sidebar search"

    OK, this time I read the title of your post. What is All Products sidebar search?

    The information I gave you (and the code you posted) is from the products_all page which, within an out-of-the-box Zen Cart configuration is accessed by clicking the All Products link that appears within the Categories sidebox. I just tested that in an OOTB configuration, disabling the Hardware category results in all sub-categories and products being disabled. No disabled product shows within the products_all page, due to the inclusion of the WHERE p.products_status = 1 clause (which only pulls in products that are enabled).

  5. #5
    Join Date
    Feb 2005
    Location
    Captain Cook, Hawaii
    Posts
    179
    Plugin Contributions
    0

    Default Re: Hide Disabled Products from "All Products sidebar search"

    I solved the problem. Operator error.
    Aloha from Hawaii! (its a dirty job, but SOMEBODY has to live here...)

 

 

Similar Threads

  1. how to disable "new products" and "all products" from category sidebox?
    By phingoc in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 31 Mar 2014, 12:40 AM
  2. v151 How do I move "New Products ..." & "All Products ..." to top of category box?
    By doooomed in forum Templates, Stylesheets, Page Layout
    Replies: 7
    Last Post: 4 Mar 2013, 06:37 PM
  3. How to remove ellipses ("...") after "All Products" and "New Products" on home page?
    By jthurman in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 18 May 2010, 03:30 PM
  4. Removing "All Products" & "New Products" from Categories Sidebox
    By MattBUK in forum Templates, Stylesheets, Page Layout
    Replies: 5
    Last Post: 18 Feb 2009, 09:39 AM
  5. Inside the "Categories" box it says "New Products" and "All Products"...
    By john9 in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 25 Feb 2007, 07:55 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