New Zenner
- Join Date:
- Mar 2011
- Posts:
- 52
- Plugin Contributions:
- 0
$productsInCategory
$productsInCategory Could anyone tell me what this function does? I have done a few searches and come up with nothing.
Views: 903
New Zenner
$productsInCategory Could anyone tell me what this function does? I have done a few searches and come up with nothing.
Black Belt
That gets the products in a category
Oba-san
This is a variable ...
One use of it is obtaining all of the Products in a Category or based on the manufacturers_id such as in the listing:
If you were to add this code to the tpl_main_page.php just below the <body> tag, you can see the results as you navigate the Categories -- OR -- Manufacturers and select a Category from the drop down ...
<?php
//$productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0, $display_limit);
$productsInCategory = zen_get_categories_products_list( (($manufacturers_id > 0 && $_GET['filter_id'] > 0) ? zen_get_generated_category_path_rev($_GET['filter_id']) : $cPath), false, true, 0);
if (is_array($productsInCategory) && sizeof($productsInCategory) > 0) {
// build products-list string to insert into SQL query
foreach($productsInCategory as $key => $value) {
$list_of_products .= $key . ', ';
}
$list_of_products = substr($list_of_products, 0, -2); // remove trailing comma
}
echo 'Products In Category: ' . $list_of_products . '<br>';
?>
It will get all of the products_id from that current categories level and all of the subcategories ...
Tell staff why this post should be reviewed.