This Function Has Been Available Since:
(AFCommerce v 2.1, Functions v 1.1)
Retrieves all products that are assigned to a given category.
Description
array = afc_get_all_category_products (catid)
This function is an easy way to find out which products are assigned to any category whether the category is the primary one for the product, or if the product is assigned to this category as an "additional" category. A product can be assigned to as many categories as you want, and whenever a visitor views that category, all products that are assigned to that category as either it's primary category or an additional category.
Parameters
catid (integer) - The category's id number
Return Values
Returns an array of product id numbers. These product id numbers are for each product assigned to this category whether it's the primary category or an additional category for that product.
Open Source: NoPaul's Examples $thiscat_prodids = afc_get_all_category_products ($catid); = count ($thiscat_prodids);
// Lets do something with them
for ($count = 0; $count < $numproducts; $count++) { $tempprodid = $thiscat_prodids[$count];
// Do something with the tempprodid here
} // ends for loop
|
Back to Functions List
|