Results 1 to 10 of 20

Hybrid View

  1. #1
    Join Date
    Jul 2005
    Posts
    46
    Plugin Contributions
    0

    Default Re: Excluding 1 Category from New Products

    Sorry... I'm not following that exactly. Didn't you say to run some kind of replace sql statement to modify the dates? It sounds like what you just wrote is something I could put in the actual source code for how the new products are pulled from the database. Is that what you meant here? If so, which file would I add this to?

  2. #2
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Excluding 1 Category from New Products

    In /includes/modules/new_products.php are 2 select statements:
    PHP Code:
    if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
      
    $new_products_query "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added
                               from " 
    TABLE_PRODUCTS " p
                               where p.products_status = 1 " 
    $display_limit;
    } else {
      
    $new_products_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_date_added,
                                               p.products_price
                               from " 
    TABLE_PRODUCTS " p
                               left join " 
    TABLE_SPECIALS " s
                               on p.products_id = s.products_id, " 
    TABLE_PRODUCTS_TO_CATEGORIES " p2c, " .
      
    TABLE_CATEGORIES " c
                               where p.products_id = p2c.products_id
                               and p2c.categories_id = c.categories_id
                               and c.parent_id = '" 
    . (int)$new_products_category_id "'
                               and p.products_status = 1 " 
    $display_limit;

    You need to add another condition to not include the master_categories_id when it is 20 ...

    In this case something like:

    and p.master_categories_id != 20

    to those two statements so that those products with the master_categories_id of 20 are blocked ...

    Another way of doing it is to utilize another table, for the products_to_categories but the statement would be more complicated ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  3. #3
    Join Date
    Jul 2005
    Posts
    46
    Plugin Contributions
    0

    Default Re: Excluding 1 Category from New Products

    This should be working... but it's not. It's still displaying the products in that master category.

    This is what I have changed it to which looks right... but category 4 products are still displaying in the new products list.

    PHP Code:
    if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
      
    $new_products_query "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added
                               from " 
    TABLE_PRODUCTS " p
                               where p.products_status = 1 and p.master_categories_id != 4" 
    $display_limit;
    } else {
      
    $new_products_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_date_added,
                                               p.products_price
                               from " 
    TABLE_PRODUCTS " p
                               left join " 
    TABLE_SPECIALS " s
                               on p.products_id = s.products_id, " 
    TABLE_PRODUCTS_TO_CATEGORIES " p2c, " .
      
    TABLE_CATEGORIES " c
                               where p.products_id = p2c.products_id
                               and p2c.categories_id = c.categories_id
                               and c.parent_id = '" 
    . (int)$new_products_category_id "'
                               and p.products_status = 1 and p.master_categories_id != 4" 
    $display_limit;

    oh... I also verified in the actual database that the master category ID for the products I'm referring to is 4. I did double check that and in the database it's showing 4 but the products are still in the list.

  4. #4
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Excluding 1 Category from New Products

    Give more "power" to the master_categories_id constraint ...
    PHP Code:
    if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
      
    $new_products_query "select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, p.products_date_added
                               from " 
    TABLE_PRODUCTS " p
                               where (p.products_status = 1 " 
    $display_limit "
                               and p.master_categories_id != 4)"
    ;
    } else {
      
    $new_products_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_date_added,
                                               p.products_price
                               from " 
    TABLE_PRODUCTS " p
                               left join " 
    TABLE_SPECIALS " s
                               on p.products_id = s.products_id, " 
    TABLE_PRODUCTS_TO_CATEGORIES " p2c, " .
      
    TABLE_CATEGORIES " c
                               where (p.products_id = p2c.products_id
                               and p2c.categories_id = c.categories_id
                               and c.parent_id = '" 
    . (int)$new_products_category_id "'
                               and p.products_status = 1 " 
    $display_limit "
                               and p.master_categories_id != 4)"
    ;

    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

  5. #5
    Join Date
    Jul 2005
    Posts
    46
    Plugin Contributions
    0

    Default Re: Excluding 1 Category from New Products

    Okay... it just occurred to me that maybe we're talking about two different things and that's why I'm not seeing this work how I'm envisioning.

    I do not see any category 4 products display in the new section of the homepage of the store... so I'm starting to think the code you have here is for just that section - WHICH IS GREAT! PERFECT!

    But... how can I also get category 4 products off the new_products listing? So when someone clicks on the "New Products" link in the actual menu and goes to this page

    http://www.site.com/index.php?main_page=products_new

    I'd like them not to display there either. Is that possible by adding the same kind exclusion parameter to the file that's used to pull the products new listing?

  6. #6
    Join Date
    Jul 2005
    Posts
    46
    Plugin Contributions
    0

    Default Re: Excluding 1 Category from New Products

    Is this code also supposed to apply to the New Product Listing page? If not, which file do I modify and add that exclusion parameter to?

    Thanks!

  7. #7
    Join Date
    Sep 2003
    Location
    Ohio
    Posts
    69,402
    Plugin Contributions
    6

    Default Re: Excluding 1 Category from New Products

    That was for the center box ...

    For the New Listing ... you need to edit the header_php.php for the /includes/modules/pages/products_new

    And for the sidebox you would also need to customize the code ...

    You didn't think it was an all for one and one for all did you ...
    Linda McGrath
    If you have to think ... you haven't been zenned ...

    Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!

    Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
    Officially PayPal-Certified! Just click here

    Try our Zen Cart Recommended Services - Hosting, Payment and more ...
    Signup for our Announcements Forums to stay up to date on important changes and updates!

 

 

Similar Threads

  1. Excluding a Category from Group Pricing?
    By Amp in forum Customization from the Admin
    Replies: 4
    Last Post: 19 Sep 2009, 07:46 PM
  2. Replies: 1
    Last Post: 14 Feb 2009, 04:22 AM
  3. Excluding category from search
    By kgeoffrey in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 13 Jan 2009, 12:46 AM
  4. Excluding items from "New Products"
    By thorcusmodee in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 12 Aug 2008, 04:07 PM
  5. Excluding a category from the Categories sidebox
    By Heather88 in forum Basic Configuration
    Replies: 5
    Last Post: 23 Apr 2007, 09:48 PM

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