Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Prevent Stock from one entire Category from appearing on the New Products page

    Version of zencart: 1.3.7 (my server runs php 4.something), so i can't upgrade any higher.
    Site has been up and running fine for ages.

    Hi all

    Basically there is one category from which we don't want any of the subcategories/products to appear on the whats new page,

    I can't work out how to prevent this using the admin, so i guess I will have to use an override,

    What i am thinking is to utilise a field that i don't use in the product listing, in this case MODEL and I will add a key word in there if i don't want the product to show up on the New Products page, the keyword would be "HIDE", so i would then alter the New Products query to add something like
    where model != "HIDE" ---- (is that how you write not equal in mysql), sorry have a toddler helping me type and I can't think straight
    But I can't find the query for the "new products" page


    Things I have already ruled out
    ALTERING THE DATE IN THE DATABASE IS NOT SUITABLE IN THIS SITUATION AS WE WANT THE CORRECT ADDED DATE displayed
    Using the parent category number in the query to block it - we have subcategories within subcategories and not all the products are at the same level if you get my meaning so we would have to add all the subcategories to an exclusion list (and there are regularly more added), or we have to do a subqueries to get the parent of the parent etc

    Any help would be greatly appreciated

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Prevent Stock from one entire Category from appearing on the New Products page

    Site has been up and running fine for ages.
    If the products in this cat have an older "date added"

    In the admin
    admin > config > maximum values > New Product Listing - Limited to ... > select a date range
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Prevent Stock from one entire Category from appearing on the New Products page

    Quote Originally Posted by kobra View Post
    If the products in this cat have an older "date added"

    In the admin
    admin > config > maximum values > New Product Listing - Limited to ... > select a date range
    Can't do that as both the category i wish to exclude and the other categories are having products added to them all the time

  4. #4
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Prevent Stock from one entire Category from appearing on the New Products page

    Ok no worries got it working, I think
    I edited the code on includes/modules/pages/product_new/header_php.php
    Code:
      $products_new_query_raw = "SELECT p.products_id, p.products_type, 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
                                 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 " . $display_limit . $order_by;
    to add AND p.products_model != 'HIDE'

    Code:
      $products_new_query_raw = "SELECT p.products_id, p.products_type, 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
                                 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 p.products_model != 'HIDE'
                                 AND pd.language_id = :languageID " . $display_limit . $order_by;
    and it seems to work

    Edit: Can I do this as an override rather than using the original page as i don't see a classic folder in this directory?
    Last edited by nigelt74; 18 Mar 2009 at 12:29 AM. Reason: would prefer to override it

  5. #5
    Join Date
    Sep 2005
    Location
    Waikato, New Zealand
    Posts
    1,539
    Plugin Contributions
    3

    Default Re: Prevent Stock from one entire Category from appearing on the New Products page

    Also thought I should add this just in case anyone else is wanting to do something similar

    The above will stop those products appearing on your "New Products" Page

    However it will not prevent the products appearing in the "New Products for Month" section of your page, if you have this turned on


    As the category that I wanted to hide the products of, was a top level category, these product were also appearing on my main page in the "New Products for Month" section to prevent this I changed this

    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 {
    to this

    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_model, p.products_price, p.products_date_added
                               from " . TABLE_PRODUCTS . " p
                               where p.products_model != 'HIDE'
                               and p.products_status = 1 " . $display_limit;
    } else {
    on the includes/modules/pages/new_products.php file (around line 18)
    and saved the file as
    on the includes/modules/pages/my_template/new_products.php where my_template is the name of your template

    edit: remember I am using version 1.3.7

    By doing it this way the "hidden" products won't ever appear on the main page in the "New Products for Month" heading, but they will still appear under that heading when i am inside the category that contains them.

    Cheers

 

 

Similar Threads

  1. v151 Prevent new products from appearing as new? Possible?
    By doooomed in forum Setting Up Categories, Products, Attributes
    Replies: 7
    Last Post: 15 Mar 2013, 03:59 PM
  2. v139a Disable a certain category of products from appearing on manufacturers page
    By pricediscrimination in forum Setting Up Categories, Products, Attributes
    Replies: 3
    Last Post: 21 May 2012, 03:47 PM
  3. featured products from one category on the main page
    By feisar in forum General Questions
    Replies: 0
    Last Post: 24 Mar 2010, 06:47 PM
  4. How to prevent New Products from displaying on category page
    By JHouse in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 2 Apr 2008, 01:07 PM
  5. How can I prevent the constant from appearing inside a button?
    By ecobebe in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 15 Jun 2006, 06:56 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