view_all_sales($start,$display); //if empty response print service unavailable message if(empty($xml)){ $htm = "
"; return $htm; } //check that $xml response is returned from api if(!empty($xml)){ if ($xml->status['code']=='400'){ $error_message=$xml->status->messages->message; return "$error_message
Please check your admin setting
"; } //parse total number of records from response $num_records = $xml->sales['total_results']; // Determine how many pages there are. if (isset($_GET['np'])) { // Already been determined. $num_pages = $_GET['np']; } else { // Need to determine. // Calculate the number of pages. if ($num_records > $display) {// More than 1 page. $num_pages = ceil ($num_records/$display);// use ceil to round up to nearest number. } else { $num_pages = 1; } } // End of np IF. $htm = "