Forums / Setting Up Categories, Products, Attributes / How to hide Inactive products in 'the selection of our products'?

How to hide Inactive products in 'the selection of our products'?

Locked

Views: 2,346

Results 1 to 10 of 10
This thread is locked. New replies are disabled.
5 Feb 2009, 7:28 PM
#1
terjekj avatar

terjekj

New Zenner

Join Date:
Dec 2008
Posts:
9
Plugin Contributions:
0

How to hide Inactive products in 'the selection of our products'?

I have products with status Inactive, however they appear in the listing of our selection of products. Once a customer clicks, the get the message ' These products are however not available for purchase.

https://www.birk.no

How to prevent these to be shown?

5 Feb 2009, 7:42 PM
#2
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: How to hide Inactive products in 'the selection of our products'?

I can't tell which link will get me to "our selection of products" because the site is not in English. If the listing you are referring to is a custom or modified listing rather than a standard zencart one, it's possible that the SQL query that generates the product has not been limited to only active products. To limit the listing to active products only, you need to ensure that the SQL query for the products table includes:

WHERE p.products_status = 1 

(assuming that the products table has been identified as 'p' in the query)

Neville
An assumption is what you arrive at when you get tired of thinking...

5 Feb 2009, 7:54 PM
#3
terjekj avatar

terjekj

New Zenner

Join Date:
Dec 2008
Posts:
9
Plugin Contributions:
0

Re: How to hide Inactive products in 'the selection of our products'?

Yes, I imagine that's the solutioion, but where to I find the php/sql that is executed?

5 Feb 2009, 7:57 PM
#4
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: How to hide Inactive products in 'the selection of our products'?

that depends on exactly which listing module is being used. Is it one of the standard New Products, Featured Products or All Products listings (and if so, which one), or is it a custom listing?

Neville
An assumption is what you arrive at when you get tired of thinking...

5 Feb 2009, 8:15 PM
#5
terjekj avatar

terjekj

New Zenner

Join Date:
Dec 2008
Posts:
9
Plugin Contributions:
0

Re: How to hide Inactive products in 'the selection of our products'?

No not any custom listing .. It shows producs in the Category

Such as : http://www.birksport.no/index.php?main_page=index&cPath=408

One Inactive product is listed here ..

Click on OUTLAND, and it says 'Beklager, produktet ble ikke funnet.' (=sorry product not found .. ) Of course, as its it's inactive .. so good it's not possible to buy it .. :dontgetit

5 Feb 2009, 8:25 PM
#6
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: How to hide Inactive products in 'the selection of our products'?

check that your file includes/index_filters/default_filter.php has not been modified. There are four sql queries there that select products - ensure that each of them includes the line

where p.products_status = 1

(they all do in the original zencart code package)

Neville
An assumption is what you arrive at when you get tired of thinking...

5 Feb 2009, 9:04 PM
#7
terjekj avatar

terjekj

New Zenner

Join Date:
Dec 2008
Posts:
9
Plugin Contributions:
0

Re: How to hide Inactive products in 'the selection of our products'?

Was not modified, and I checked in mysql that the status is 0 for zen_products ..

5 Feb 2009, 9:26 PM
#8
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: How to hide Inactive products in 'the selection of our products'?

hmmm....

I'd like to see a copy of what the actual sql query is for the page.

Make an override copy of templates/tpl_index_product_list.php, and modify it by adding

<?php  echo $listing_sql; ?>

after this line:

<?php } // categories_description ?>

load that to your server, and you should see the listing sql query on a category page - copy that and paste it here. Once you have it copied, remove that added line from the file on your server to take the page back to normal.

Neville
An assumption is what you arrive at when you get tired of thinking...

5 Feb 2009, 9:41 PM
#9
bunyip avatar

bunyip

Totally Zenned

Join Date:
Sep 2004
Location:
Western Massachusetts
Posts:
2,361
Plugin Contributions:
1

Re: How to hide Inactive products in 'the selection of our products'?

I think I found your problem....

Look in the file modules/new_products.php

at about line 40 there is a query defined for the variable $new_products_query that does NOT have a filter for products_status. Add a filter into that query so that it reads:

   $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 p.products_status = 1 
and pd.language_id = '" . (int)$_SESSION['languages_id'] . "' 
and p.products_id in (" . $list_of_products . ")";

and save that as includes/modules/YOUR_TEMPLATE/new_products.php

Neville
An assumption is what you arrive at when you get tired of thinking...

7 Feb 2009, 2:36 PM
#10
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: How to hide Inactive products in 'the selection of our products'?

You may wish to apply the Known Bug Fixes for v1.3.8 ...
http://www.zen-cart.com/forum/showthread.php?p=659717#post659717

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!