Grid object contains total number of records in the database, and recordset object with list of all returned records.

 

Methods:

getTotalCount() – gets total number of records in database (can be higher than number of records returned)

getRecordset() – returns recordset object, that can be iterated by foreach PHP command to get the records.

Example of using grid:

 
//----------------------------------------------
// get recordset with list of affiliates
$request = new Gpf_Rpc_GridRequest("Pap_Merchants_User_AffiliatesGrid", "getRows", $session);

// sets limit to 30 rows, offset to 0 (first row will start)
$request->setLimit(0, 30);

// send request
try {
  $request->sendNow();
} catch(Exception $e) {
  die("API call error: ".$e->getMessage());
}

// request was successful, get the grid result
$grid = $request->getGrid();

// get recordset from the grid
$recordset = $grid->getRecordset();

// iterate through the records
foreach($recordset as $rec) {
  echo 'Affiliate name: '.$rec->get('firstname').' '.$rec->get('lastname').'<br>';
}