Happpi PHP Library

getCategoryParts()

Retrieves all of the parts within a category.

Return Type

Array of type: CurtPart

Required Parameters

    getCategoryParts(int $catID, int $page, int $perpage)

Optional Parameters

    None

Dependencies

    None

Example:


<!-- getCategoryParts() -->
<?php
	require_once('libraries/happpi/LoadAll.php'); // points to the LoadAll.php file for loading the library.

	// once the library is required, you can now use one of the main "interaction" classes.
	// These interaction classes contain methods that get information from our REST API and
	// converts them to PHP objects for you to use.
	$Part = new CurtPart(); // create new part object to gain access to its functions.

	echo "<h2>All parts within a category by category ID</h2>";

	$catID = 3; // category for class 1 trailer hitches
	$page = 1; // show page number 1
	$perpage = 10; // show 10 per page

	$listofParts = $Part->getCategoryParts($catID, $page, $perpage); // use getCategoryParts() to get an array of parts contained in a category.
	foreach($listofParts as $partObj){ // step through the list of part objects
		echo $partObj->getShortDesc(); // display the short description of each part object.
		echo "<br />";
	}
?>