Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What does "$include_inactive" mean in "tep_count_products_in_category" function?


g_p_java

Recommended Posts

Posted

Hello,

 

i'm studying catalog/includes/boxes/categories.php.

In line 48 there is a call to a function tep_count_products_in_category.

This function returns the number of products in a category and it is

placed in includes/functions/general.php in line 373.

 

The function has two parameters,$category_id and $include_inactive=false.

Where is $include_inactive used?

I cannot understand.

I noticed that when it's true the query in if condition does not consist of p.products_status='1'.

That means that is going to count products which are out of stock right??

When is that going to happen??

 

The code is as follows

if ($include_inactive == true) {
     $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$category_id . "'");
   } else {
     $products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . (int)$category_id . "'");
   }

 

May sm explain to me what is $include_inactive and when does it turn true??

 

 

thanks, in advance

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...