Page 4 of 5 FirstFirst ... 2345 LastLast
Results 31 to 40 of 44
  1. #31
    Join Date
    Nov 2006
    Posts
    512
    Plugin Contributions
    0

    Default Re: Can I "Hide" a product?

    chiming in Thanks!
    Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

  2. #32
    Join Date
    Jan 2009
    Posts
    2,123
    Plugin Contributions
    0

    Default Re: Can I "Hide" a product?

    The best way to hide a product properly is this:

    1. create a main category called "hidden"
    2. switch that category off so it shows the red square in admin
    3. create the products you wish to hide, inside of this category
    4. to make these products hidden from the NEW products, ALL products and SEARCH pages, follow these steps:

    includes/modules/pages/products_all/header_php.php
    change this:
    PHP 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;

      
    $products_all_query_raw $db->bindVars($products_all_query_raw':languageID'$_SESSION['languages_id'], 'integer');
      
    $products_all_split = new splitPageResults($products_all_query_rawMAX_DISPLAY_PRODUCTS_ALL); 
    to this:
    PHP 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 p.master_categories_id != XXX
                                 AND pd.language_id = :languageID " 
    $order_by;

      
    $products_all_query_raw $db->bindVars($products_all_query_raw':languageID'$_SESSION['languages_id'], 'integer');
      
    $products_all_split = new splitPageResults($products_all_query_rawMAX_DISPLAY_PRODUCTS_ALL); 
    includes/modules/pages/products_new/header_php.php
    change this:
    PHP 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;

      
    $products_all_query_raw $db->bindVars($products_all_query_raw':languageID'$_SESSION['languages_id'], 'integer');
      
    $products_all_split = new splitPageResults($products_all_query_rawMAX_DISPLAY_PRODUCTS_ALL); 
    to this:
    PHP 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 p.master_categories_id != XXX
                                 AND pd.language_id = :languageID " 
    $order_by;

      
    $products_all_query_raw $db->bindVars($products_all_query_raw':languageID'$_SESSION['languages_id'], 'integer');
      
    $products_all_split = new splitPageResults($products_all_query_rawMAX_DISPLAY_PRODUCTS_ALL); 
    includes/modules/pages/advanced_search_results/header_php.php
    add the red part:
    Code:
    if ((DISPLAY_PRICE_WITH_TAX == 'true') && ((isset($_GET['pfrom']) && zen_not_null($_GET['pfrom'])) || (isset($_GET['pto']) && zen_not_null($_GET['pto'])))) {
      $where_str .= " group by p.products_id, tr.tax_priority";
    }
    
    $where_str .= " AND p.master_categories_id != XXX";


    NOTE: I've used 'XXX' to represent the id number of the 'hidden' catagory you created. Change all instances of XXX to the unique category ID of your 'hidden' category.

  3. #33
    Join Date
    Nov 2010
    Posts
    8
    Plugin Contributions
    0

    Default Re: Can I "Hide" a product?

    Thanks limelites for the explanation.

    I want to add something.

    I was able to take this approach and exclude normal shipping rates/zones and rates if the hidden product was in cart.

    This approach is similar to what some stores use when they provide manual shipping quotes and as long as the customer has this quote in cart, shipping to undefined zones are allowed and the hidden product is treated as shipping.

    Anyways, I used this approach with zone tables.

    in

    HTML Code:
    /includes/modules/shipping/zones.php
    Replaced
    PHP Code:
    $this->quotes = array('id' => $this->code,
                                
    'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE,
                                
    'methods' => array(array('id' => $this->code,
                                                         
    'title' => $shipping_method,
                                                         
    'cost' => $shipping_cost))); 
    with the following:

    PHP Code:
          global $cart;      
          
    $chk_flat_cat $_SESSION['cart']->in_cart_check('master_categories_id','10');
          if (
    $chk_flat_cat == 1) {
                    
    $this->quotes = array('id' => $this->code,
                                
    'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE,
                                
    'methods' => array(array('id' => $this->code,
                                                         
    'title' => 'Shipping Included',
                                                         
    'cost' => 0)));
          } else {
          
    $this->quotes = array('id' => $this->code,
                                
    'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE,
                                
    'methods' => array(array('id' => $this->code,
                                                         
    'title' => $shipping_method,
                                                         
    'cost' => $shipping_cost)));
          } 
    There maybe an easier approach but I found this very useful.

    I have used the 'add to cart via url' approach to add the product to customer's cart.

  4. #34
    Join Date
    Nov 2010
    Posts
    8
    Plugin Contributions
    0

    Default Re: Can I "Hide" a product?

    I just realized I missed somethng from my previous post.

    There is one more code change to allow checkout to proceed. This is located in the same file.

    Find:
    PHP Code:
          if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon$this->title);



          if (
    strstr(MODULE_SHIPPING_ZONES_SKIPPED$dest_country)) {

        
    $this->quotes = array();

          } else {

            if (
    $error == true$this->quotes['error'] = MODULE_SHIPPING_ZONES_INVALID_ZONE;

          }



          return 
    $this->quotes;

        } 
    Change to:

    PHP Code:

          
    if (zen_not_null($this->icon)) $this->quotes['icon'] = zen_image($this->icon$this->title);

          if (
    strstr(MODULE_SHIPPING_ZONES_SKIPPED$dest_country)) {
           
            
    $this->quotes = array();
          } elseif (
    $chk_flat_cat == 1) {
               return 
    $this->quotes;
          } else {
            if (
    $error == true$this->quotes['error'] = MODULE_SHIPPING_ZONES_INVALID_ZONE;
          }

          return 
    $this->quotes;
        } 

  5. #35

    Default Re: Can I "Hide" a product?

    I also want to be able to hide products completely that are part of hidden categories.

    Thank you 'limelites' for the code you posted. Using that as a base, I made a modified version (see below), that is a bit more generic: it excludes any product whose master category is hidden. This avoids having to hard code the special category.

    Personally, I think Zencart should behave this way by default, and would love to see these changes rolled up into a future release. I can't think of a good reason why you would want a product in a hidden category to show up in searches, new product listings, all products, etc.

    Also, I found one more display case that needed to be fixed the same way (New Products, when displayed from the home page, rather than a category).

    So, here are the code changes I made:

    includes/modules/pages/products_all/header_php.php
    change this:

    PHP 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
    to this:

    PHP 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_CATEGORIES " c LEFT JOIN " TABLE_PRODUCTS " p
                                 ON (p.master_categories_id = c.categories_id )
                                 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
                                 AND c.categories_status = 1 " 
    $order_by

    includes/modules/pages/products_new/header_php.php
    change this:

    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,
                                        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 " 
    $display_limit $order_by
    to this:

    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,
                                        p.master_categories_id
                                 FROM " 
    TABLE_CATEGORIES " c LEFT JOIN " TABLE_PRODUCTS " p
                                 ON (p.master_categories_id = c.categories_id )
                                 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 .
                                 
    " AND c.categories_status = 1 " $order_by
    includes/modules/pages/advanced_search_results/header_php.php
    change this:

    PHP Code:
    $where_str " WHERE (p.products_status = 1
                   AND p.products_id = pd.products_id
                   AND pd.language_id = :languagesID
                   AND p.products_id = p2c.products_id
                   AND p2c.categories_id = c.categories_id "

    to this:

    PHP Code:
    $where_str " WHERE (p.products_status = 1
                   AND p.products_id = pd.products_id
                   AND pd.language_id = :languagesID
                   AND p.products_id = p2c.products_id
                   AND p2c.categories_id = c.categories_id
                   AND c.categories_status = 1"

    includes/modules/new_products.php
    change this:

    PHP Code:
      $new_products_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                    p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                               from " 
    TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd
                               where p.products_id = pd.products_id
                               and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
                               and   p.products_status = 1 " 
    $display_limit
    to this:

    PHP Code:
      $new_products_query "select distinct p.products_id, p.products_image, p.products_tax_class_id, pd.products_name,
                                    p.products_date_added, p.products_price, p.products_type, p.master_categories_id
                               from " 
    TABLE_PRODUCTS " p, " TABLE_PRODUCTS_DESCRIPTION " pd, " .
                               
    TABLE_CATEGORIES " c " .
                               
    "where p.products_id = pd.products_id
                               and pd.language_id = '" 
    . (int)$_SESSION['languages_id'] . "'
                               and p.products_status = 1 
                               and p.master_categories_id = c.categories_id 
                               and c.categories_status = 1" 
    .
                               
    $display_limit

  6. #36
    Join Date
    Jun 2010
    Posts
    4
    Plugin Contributions
    0

    Default Re: Can I "Hide" a product?

    Hi Deepnet,
    Was there something needing to be added to link my specific Hidden folder?
    I tried modifying all the files you said but no luck. No change at all infact


    thanks in advance

  7. #37

    Default Re: Can I "Hide" a product?

    Was there something needing to be added to link my specific Hidden folder?
    I tried modifying all the files you said but no luck. No change at all in fact
    I'm not sure I understand the question... are your products (in hidden folders) still showing up in the searches and product listings?

    If you're wondering how to let customers get to your hidden products, what I do is create a special URL with the product_info set to the hidden product, like:

    ".../index.php?main_page=product_info&products_id=23"

    For the actual hidden folders, I set the status to 'disabled' in the catalog manager, then added the products to the disabled folders.

    If I misunderstood the question, let me know the details and I'll try and help.

  8. #38
    Join Date
    Jun 2010
    Posts
    4
    Plugin Contributions
    0

    Default Re: Can I "Hide" a product?

    I have a "hidden" category set up which is disabled. I have another category within this category which is active and has active product. I made all the modifications as you specified but the products Im trying to hide still show up in the search and the newest items.

    What I was wondering was did I need to enter the hidden categories id # somewhere in your modified coding?

  9. #39

    Default Re: Can I "Hide" a product?

    Ah... make all the categories disabled, not just the root one. That should do it.

    You do not need to enter any category ids in the code... the code just makes sure all parent nodes are hidden.

  10. #40
    Join Date
    May 2010
    Location
    Athens, Greece
    Posts
    292
    Plugin Contributions
    0

    Default Re: Can I "Hide" a product?

    Although it's now a year since limelites' post #32 above, I used his very clear and accurate instructions to hide a product and just wish to express my thanks for the solution.

 

 
Page 4 of 5 FirstFirst ... 2345 LastLast

Similar Threads

  1. v150 How do I edit Product Listing "Price", "Qty." and Product Info Move "details"?
    By schobook in forum Templates, Stylesheets, Page Layout
    Replies: 9
    Last Post: 18 Jan 2013, 01:02 AM
  2. Replies: 0
    Last Post: 27 Nov 2011, 06:04 PM
  3. Can I make all "add: 0" input boxes on product pages to "more info..."?
    By sfklaas in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 15 Aug 2009, 06:05 PM
  4. How can I hide the "back to shopping" button?
    By heheno1 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 1 May 2009, 10:56 PM
  5. Can you "cloak"/hide an attribute (downloads)
    By Oberst in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 21 Oct 2006, 01: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