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



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_AffiliatesGridSimple", "getRows", $session);

$request->addParam('columns', new Gpf_Rpc_Array([['id'], ['firstname'], ['lastname']]));

// sets limit to 30 rows
$request->setLimit(0, 30);

// send request
try {
} 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>';