Happpi PHP Library

getPartBreadCrumbs()

Returns the categories and subcategories in which it took to get to this part.

Return Type

Array of type: CurtCategory

Required Parameters

    getPartBreadCrumbs(int $catID)

Optional Parameters

    None

Dependencies

    $part->setPartID(int $value)

Example:

<!-- getPartBreadCrumbs -->
<?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.
	$Part->setPartID(11000); // set the partID as a required dependency
	echo "<h2>BreadCrumbs for Part: 11000:</h2>";
	$listOfPartBreadCrumbs = $Part->getPartBreadCrumbs(3); // call getPartBreadCrumbs() and pass in the category which returns an array of categories in order. 
	// each breadcrumb is a category.
	$numItems = count($Part->getPartBreadCrumbs()); // count how many bread crumbs there are.
	$i = 0;
	foreach($listOfPartBreadCrumbs as $partBreadCrumb){ // step through each category in your list of BreadCrumbs.
		$i++;
		if($i == ($numItems)){  // check to see if it is the last breadcrumb so you dont include a > at the end.
			echo '<a href="YourCategoryPage.php?catID=' . $partBreadCrumb->getCatID() . '">';
			echo $partBreadCrumb->getCatTitle();
			echo "</a>";
		}else{
			echo '<a href="YourCategoryPage.php?catID=' . $partBreadCrumb->getCatID() . '">';			
			echo $partBreadCrumb->getCatTitle();
			echo "</a>";
			echo " > ";
		}
	} 
?>