Happpi PHP Library

getParts()

Retrieves a list of parts for that vehicle

Return Type

Array of type: CurtPart

Required Parameters

    None

Optional Parameters

    None

Dependencies

    Optional: $vehicle->setMount(string $value)
    $vehicle->setYear(flaot $value)
    $vehicle->setMake(string $value)
    $vehicle->setModel(string $value)
    $vehicle->setStyle(string $value)

    Or

    $vehicle->setVehicleID(int $value)

Example:

<?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.
    $vehicle = new CurtVehicle(); // create new vehicle object to gain access to its functions.
 
    $vehicle->setMount("rear"); // set optional "dependency" of mount.
    $vehicle->setYear(2010); // set dependency of year.
    $vehicle->setMake("Ford"); // set dependency of make.
    $vehicle->setModel("F-150"); // set dependency of model.
    $vehicle->setStyle("Except with Factory Equipped Hitch"); // set dependency of style.
    $myVehicle = $vehicle->getVehicle(); // call getVehicle which returns a CurtVehicle object.
 
    echo "<h2>Parts for Vehicle ID: " . $myVehicle->getVehicleID() .  "</h2>";// get the vehicleID showing a new CurVehicle object was returned.
     
    $partsForMyVehicle = $myVehicle->getParts(); // call getParts which returns a list of parts for the vehicle.
    foreach($partsForMyVehicle as $part){ // step through the list of parts
        echo $part->getShortDesc(); //display the short description for each part.
        echo "<br />";
    }
?>