Happpi PHP Library

getCategoryPartsByName()

Retrieves all of the parts from a category by name.

Return Type

Array of type: CurtPart

Required Parameters

    getCategoryParts(string $catName, int $page, int $perpage)

Optional Parameters

    None

Dependencies

    None

Example:

<!-- getCategoryPartsByName() -->
<?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 name: Class I Trailer Hitches</h2>";

	$catName = "Class I Trailer Hitches"; // category name
	$page = 1; // show page number 1
	$perpage = 10; // show 10 per page

	$listofParts = $Part->getCategoryPartsByName($catName, $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 />";
	}
?>