Can I "Hide" a product?

Views: 27,499

Results 21 to 40 of 44
11 Sep 2008, 1:26 AM
#21
snowkrash avatar

snowkrash

New Zenner

Join Date:
Aug 2007
Posts:
65
Plugin Contributions:
0

Can I "Hide" a product?

sorry, the payment module I'm implementing is called "Account Holders"

11 Sep 2008, 8:46 AM
#22
pasi avatar

pasi

Zen Follower

Join Date:
Mar 2004
Location:
Finland
Posts:
435
Plugin Contributions:
1

Re: Can I "Hide" a product?

The developers should add a field in the product admin that let's you hide the product...

Like "in stock", "out of stock" and "hidden" ... let's say make the product_status in database a tinyint and set out of stock to 0, in stock to 1 and hidden 2 etc...

I need this feature, because I'd like to have customer group specific products which I individually advertise to them...
I sell to many car clubs around finland and don't want BMW-related stickers show to Alfa Romeo drivers ;)

Working with Zen Cart since 2003 :: www.prr.fi
Author of the original Finnish language pack for Zen Cart since 2004

6 Oct 2008, 1:12 PM
#23
richcolour avatar

richcolour

New Zenner

Join Date:
Dec 2007
Posts:
24
Plugin Contributions:
0

Re: Can I "Hide" a product?

I found a simple way to hide a product. This method works if you just want it hidden from your categories list. It will still appear in New Products, All Products and Search results.

  1. Make a New Category called 'Hidden' or something relevant

  2. Create your New hidden product in it

  3. Take a note of the product's ID number (at the start of the product's list entry)

  4. Turn off the Hidden category by making its status Red

  5. That turns off your product, so go back and make it's status Green

  6. Go to your live shop and click on one of your products. In its URL you'll see ID=(something). Change that ID number to your hidden product. That is the new URL to go directly to your hidden item.

------------------------------------------------------------
I sell plain black and colourful T-shirts thanks to Zen Cart

11 Oct 2008, 2:51 PM
#24
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: Can I "Hide" a product?

jammin320:

This thread is a little old, but I found it very useful. However, it seems that nobody figured out the SQL changes requiered to remove a hidden category from the All Products link and the search engine. I have done it (it seems) and here are the changes that I made. For me, the category ID that I want to hide is number 20. That number will be different for you.

includes/modules/pages/advanced_search_result/header_php.php
Changed line 249 from:

AND p2c.categories_id = c.categories_id ";

To:

AND p2c.categories_id = c.categories_id
AND p.master_categories_id != '20' ";

includes/modules/pages/products_all/header_php.php
changed line 30 from:

AND pd.language_id = :languageID " . $order_by;

To:

AND pd.language_id = :languageID
AND p.master_categories_id != '20'" . $order_by;
This works beautifully.

However is there a way using this same method or other coding that will skip/hide products that are in a category (ex. 89) on the manufacturers_id page?

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

15 Apr 2009, 1:37 AM
#25
zcnb avatar

zcnb

Zen Follower

Join Date:
Jun 2008
Posts:
338
Plugin Contributions:
0

Re: Can I "Hide" a product?

richcolour:

I found a simple way to hide a product. This method works if you just want it hidden from your categories list. It will still appear in New Products, All Products and Search results.

  1. Make a New Category called 'Hidden' or something relevant

  2. Create your New hidden product in it

  3. Take a note of the product's ID number (at the start of the product's list entry)

  4. Turn off the Hidden category by making its status Red

  5. That turns off your product, so go back and make it's status Green

  6. Go to your live shop and click on one of your products. In its URL you'll see ID=(something). Change that ID number to your hidden product. That is the new URL to go directly to your hidden item.

This method works for me, too. I actually downloaded the hideCategories add-on with the intention to install it, but applying it seems to require some careful attention and time (i.e. overwriting or merging with some core files). So, your solution is a simple workaround if it is not critical that the "hidden" product will be found by mistake.

Thanks!

21 Apr 2009, 11:46 PM
#26
digidiva_kathy avatar

digidiva_kathy

Zen Follower

Join Date:
May 2006
Posts:
323
Plugin Contributions:
0

Re: Can I "Hide" a product?

zcnb:

This method works for me, too. I actually downloaded the hideCategories add-on with the intention to install it, but applying it seems to require some careful attention and time (i.e. overwriting or merging with some core files). So, your solution is a simple workaround if it is not critical that the "hidden" product will be found by mistake.

Thanks!

I followed these instructions, but it still shows up in the New Products listing...does it not for you?

9 Dec 2009, 5:44 PM
#27
enquirer66 avatar

enquirer66

Zen Follower

Join Date:
Sep 2007
Posts:
215
Plugin Contributions:
0

Re: Can I "Hide" a product?

Has anyone come up with anything new since April? Would find it very useful and judging by the comments so would others.

10 Dec 2009, 6:12 AM
#28
jammin320 avatar

jammin320

Zen Follower

Join Date:
Mar 2007
Location:
Seattle, WA
Posts:
158
Plugin Contributions:
0

Re: Can I "Hide" a product?

Good evening,

I haven't worked on this since my original solution, however that patch has been in place on one of my stores for some time yet and has not failed once. If there is a more condensed version way to address this issue, I have not heard of it.

Best of luck!

14 Feb 2010, 2:19 AM
#29
debbers avatar

debbers

New Zenner

Join Date:
Feb 2009
Posts:
15
Plugin Contributions:
0

Re: Can I "Hide" a product?

jammin320:

Thanks so much for your post in message 16 - you saved me the time of tracing it back to do the edits.

Worked like a champ,

deb

14 Feb 2010, 4:31 PM
#30
jammin320 avatar

jammin320

Zen Follower

Join Date:
Mar 2007
Location:
Seattle, WA
Posts:
158
Plugin Contributions:
0

Re: Can I "Hide" a product?

I'm glad it helped. Thanks for the feedback!

14 Feb 2010, 5:51 PM
#31
dharma avatar

dharma

Totally Zenned

Join Date:
Nov 2006
Posts:
505
Plugin Contributions:
0

Re: Can I "Hide" a product?

chiming in :clap: Thanks!

Zencart 1.3.9h - PHP 5.2.13 - My SQL 5.0.84 - Apache 1.3.41

16 Aug 2010, 9:10 PM
#32
limelites avatar

limelites

Totally Zenned

Join Date:
Jan 2009
Posts:
2,085
Plugin Contributions:
0

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:

$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_raw, MAX_DISPLAY_PRODUCTS_ALL);  

to this:

 $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_raw, MAX_DISPLAY_PRODUCTS_ALL);  

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

$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_raw, MAX_DISPLAY_PRODUCTS_ALL);  

to this:

 $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_raw, MAX_DISPLAY_PRODUCTS_ALL);  

includes/modules/pages/advanced_search_results/header_php.php
add the red part:

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.

6 Nov 2010, 9:20 AM
#33
world_surfer avatar

world_surfer

New Zenner

Join Date:
Nov 2010
Posts:
8
Plugin Contributions:
0

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

/includes/modules/shipping/zones.php

Replaced

$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:

	  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.

6 Nov 2010, 9:41 AM
#34
world_surfer avatar

world_surfer

New Zenner

Join Date:
Nov 2010
Posts:
8
Plugin Contributions:
0

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:

      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:

     

      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;
    }
20 Jan 2011, 11:53 PM
#35
deepnet avatar

deepnet

New Zenner

Join Date:
Jan 2011
Posts:
14
Plugin Contributions:
0

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:

  $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:

  $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:

  $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:

  $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:

$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:

$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:

  $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:

  $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;
21 Mar 2011, 9:56 PM
#36
polyestercowboy avatar

polyestercowboy

New Zenner

Join Date:
Jun 2010
Posts:
4
Plugin Contributions:
0

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

21 Mar 2011, 10:31 PM
#37
deepnet avatar

deepnet

New Zenner

Join Date:
Jan 2011
Posts:
14
Plugin Contributions:
0

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.

21 Mar 2011, 11:13 PM
#38
polyestercowboy avatar

polyestercowboy

New Zenner

Join Date:
Jun 2010
Posts:
4
Plugin Contributions:
0

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?

22 Mar 2011, 2:36 AM
#39
deepnet avatar

deepnet

New Zenner

Join Date:
Jan 2011
Posts:
14
Plugin Contributions:
0

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.

30 Jul 2011, 8:47 AM
#40
athens_collectibles avatar

athens_collectibles

Zen Follower

Join Date:
May 2010
Location:
Athens, Greece
Posts:
293
Plugin Contributions:
0

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.