Page 1 of 2 12 LastLast
Results 1 to 10 of 20
  1. #1
    Join Date
    Jul 2005
    Posts
    46
    Plugin Contributions
    0

    Default Excluding 1 Category from New Products

    Not sure if this is the right forum to ask this....

    Is there a way I can exclude one category from appearing in the New Products selection? I have a fund-raising category that I do not want to appear as new products - products that are displayed under NEW on the main page of the store and products that list in the New Products link from the menu.

    I was thinking there might be something I could hardcode to exclude the new section from picking up this category.

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

    Default Re: Excluding 1 Category from New Products

    Anyone? *** bump ***

  3. #3
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Excluding 1 Category from New Products

    You can adjust this in the DB, but unfortunately this function is by product and not by category. This is done by adjusting the add date back to one that will not be picked up as new.

    There also might be a way to code this, but as I am php challenged, this would have to come from another.
    Zen-Venom Get Bitten

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

    Default Re: Excluding 1 Category from New Products

    Yeah... I knew about the added date thing. My problem is there are products added to this category regularly enough that manually editing the dates would be a pain.

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

    Default Re: Excluding 1 Category from New Products

    When adding to this Category that you want to exclude ... are these Products Linked Products to other categories? Or just belong to 1 Category?

    If they are not Linked Products, then you could run a nifty little update on the products table from the Admin ... Tools ... Insert SQL Patches ... to fix the dates of all products where master_categories_id = XX
    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!

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

    Default Re: Excluding 1 Category from New Products

    Ah... yes that would work. Not sure how to write the replace statement code though. Could you help me with that?

    So for instance, say the master_category is 20, how would the mysql statement syntax be written to replace those dates with 6/1/06?

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

    Default Re: Excluding 1 Category from New Products

    If all the products to be excluded are master_categories_id = 20 ... you could add the statement:

    AND master_categories_id != 20

    To the 2 select statements to exclude them ...
    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!

  8. #8
    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?

  9. #9
    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!

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

 

 
Page 1 of 2 12 LastLast

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