shopp_product_category()

get a ProductCategory object

shopp_product_category ( $cat, $options )

@param int $cat the category id
@param array $options (optional) loading options
@return bool|ProductCategory returns false on error, ProductCategory on success

Description

get a ProductCategory object

Product loading options

The $options parameter can be used to load the category’s products.

Default options:

  • columns – (defaults to false) Include extra columns (string) ‘c.col1,c.col2…’
  • useindex – (defaults to false) FORCE INDEX to be used on the product table (string) ‘indexname’
  • joins – (defaults to array()) JOIN tables array(‘INNER JOIN table AS t ON p.id=t.column’)
  • where – (defaults to array()) WHERE query conditions array(‘x=y OR x=z’,’a!=b’…) (array elements are joined by AND
  • groupby – (defaults to false) GROUP BY column (string) ‘column’
  • having – (defaults to array()) HAVING filters
  • limit – (defaults to false) Limit
  • order – (defaults to false) ORDER BY columns or named methods (string) such as ‘bestselling’,’highprice’,’lowprice’,’newest’,’oldest’,’random’,’chaos’,’title’
  • page – (defaults to false) Current page number to load
  • paged – (defaults to false) Entries per page to load
  • nostock – (defaults to true) Override to show products that are out of stock (string) ‘on’,’off’,’yes’,’no’…
  • pagination – (defaults to true) Enable alpha pagination (string) ‘alpha’
  • published – (defaults to true) Load published or unpublished products (string) ‘on’,’off’,’yes’,’no’, true, false
  • ids – (defaults to false) Flag for loading product IDs only
  • adjacent – (defaults to false)
  • product – (defaults to false)
  • load – (defaults to array()) Product data to load
  • inventory – (defaults to false) Flag for detecting inventory-based queries
  • debug – (defaults to false) Output the query for debugging

Example

// load product category 5 with default options
$Cat = shopp_product_category(5);

// set the current global collection
ShoppCollection($Cat);

See Also

You must be logged in to post a comment.

© Ingenesis Limited. Shopp™ is a registered trademark of Ingenesis Limited.

Skip to toolbar