I am getting Terminology wrong or It is quite possible to do?
I am having a PHP page which makes an ebay Api call for seller Profile Search Result, The result is based on the Form Field Input :- Sellername , Country Location etc etc.
I had Kept the HTML content in the PHP with simple HTML FORM and Includes a Class File which takes SellerID as Parameter and return back data embedded into table format of HTML so that return data can be used directly as an HTML to display on webpage using print command.
So far i am able to get data of each individual seller, how can i append my past last 5 seller profile result show ?
As whenever i input the new seller name in search column it refreshes the page which make the data Unusable.
attaching the code of PHP File which create query page and display result.
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<?php
include_once 'SellerProfile.php';
include_once 'AppendData.php';
$sellerID='';
$pageResults='';
//$sellerDetail;
if(isset($_POST['SellerID'])){
// DEBUG -----
$debug = true;
$debug = (boolean) $_POST['Debug'];
// CLEAN SELLER ID -----
$sellerID = urlencode (utf8_encode($_POST['SellerID'])); // cleanse input
// CLEAN GLOBAL ID -----
$globalID = urlencode (utf8_encode($_POST['GlobalID']));
// ASOSIATED ARRAY OF SITE ID
$sitearray = array(
'EBAY-US' => '0',
'EBAY-ENCA' => '2',
'EBAY-GB' => '3',
'EBAY-AU' => '15',
'EBAY-DE' => '77',
'EBAY-IN' => '203',
);
// TAKE VALUE FROM ASSOSIATED ARRAY AND SPITOUT ITS VALUE
$siteID = $sitearray[$globalID];
// $sellerDetail->debug = $debug;
// $sellerDetail->siteID = $siteID;
$sellerDetail = new \Ebay_Profile\SellerProfile($sellerID,$siteID,$debug);
//$history = '';
//$history = new \Ebay_Profile\AppendData($sellerDetail);
$pageResults = '';
$pageResults .= $sellerDetail;
}
?>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>GetUserProfile</title>
<script src="./js/jQuery.js"></script>
<script src="./js/jQueryUI/ui.tablesorter.js"></script>
<!--<script>
$(document).ready(function() {
$("table").tablesorter({
sortList:[[7,0],[4,0]], // upon screen load, sort by col 7, 4 ascending (0)
debug: false, // if true, useful to debug Tablesorter issues
headers: {
0: { sorter: false }, // col 0 = first = left most column - no sorting
5: { sorter: false },
6: { sorter: false },
7: { sorter: 'text'} // specify text sorter, otherwise mistakenly takes shortDate parser
}
});
});
</script>-->
</head>
<body>
<link rel="stylesheet" href="./css/flora.all.css" type="text/css" media="screen" title="Flora (Default)">
<!--
<form
action = 'Specifies where to send the form-data when a form is submitted
method = 'Specifies the HTTP method to use when sending form-data'
</form>
-->
<form action="LoadProfile.php" method="post">
<table cellpadding="2" border="0">
<tr>
<th>SellerID</th>
<th>Site</th>
<th>ItemType</th>
<th>ItemSort</th>
<th>Debug</th>
</tr>
<tr>
<td><input type="text" name="SellerID" value=""></td>
<td>
<select name="GlobalID">
<option value="EBAY-AU">Australia - EBAY-AU (15) - AUD</option>
<option value="EBAY-ENCA">Canada (English) - EBAY-ENCA (2) - CAD</option>
<option value="EBAY-DE">Germany - EBAY-DE (77) - EUR</option>
<option value="EBAY-GB">United Kingdom - EBAY-GB (3) - GBP</option>
<option selected value="EBAY-US">United States - EBAY-US (0) - USD</option>
<option selected value="EBAY-IN">INDIA - EBAY-IN (203) - INR</option>
</select>
</td>
<td>
<select name="ItemType">
<option selected value="All">All Item Types</option>
<option value="Auction">Auction Items Only</option>
<option value="FixedPriced">Fixed Priced Item Only</option>
<option value="StoreInventory">Store Inventory Only</option>
</select>
</td>
<td>
<select name="ItemSort">
<option value="BidCountFewest">Bid Count (fewest bids first) [Applies to Auction Items Only]</option>
<option selected value="EndTimeSoonest">End Time (soonest first)</option>
<option value="PricePlusShippingLowest">Price + Shipping (lowest first)</option>
<option value="CurrentPriceHighest">Current Price Highest</option>
</select>
</td>
<td>
<select name="Debug">
<option value="1">true</option>
<option selected value="0">false</option>
</select>
</td>
</tr>
<tr>
<td colspan="4" align="center"><INPUT type="submit" name="submit" value="Search"></td>
</tr>
</table>
</form>
<?php
print $pageResults;
print $history;
$allItemsURL = "http://search.ebay.com/_W0QQsassZ" . $sellerID;
print "<p><a href=\"$allItemsURL\">See all items from this seller</a></p>";
?>
</body>
</html>
Content of the Class File which make Ebay API Query
<?php
/**
* Created by PhpStorm.
* User: kapilsoni
* Date: 13/11/15
* Time: 2:37 AM
*/
namespace Ebay_Profile;
class SellerProfile
{
// public $sellerName = '';
// public $siteID = '';
// public $debug;
public $details = '';
function __construct($idOfSeller,$globalID,$debug){
// $this->sellerName = $idOfSeller;
// $this->siteID = $globalID;
// $this->debug = $debug;
$results = '';
$apicall = "http://open.api.ebay.com/shopping?callname=GetUserProfile"
. "&version=667"
. "&siteid=$globalID"
. "&appid=APIID"
. "&UserID=$idOfSeller"
. "&IncludeSelector=Details,FeedbackHistory" // need Details to get MyWorld info
. "&responseencoding=XML";
if ($debug) { print "<br />GetUserProfile call = <blockquote>$apicall </blockquote>"; }
$resp = simplexml_load_file($apicall);
if($resp){
//Setting Construction of html table
$results .= "<table><tr>";
//Setting User Image and Ebay Link of Seller
//$results .= "<td><a href=\"" . $resp->User->MyWorldURL . "\"><img src=\""
// . $myWorldImgURL . "\"></a></td>";
//Setting Seller ID
$results .= "<td>Seller : $idOfSeller <br /> ";
// Feedback Score
$feedbackScore = $resp->User->FeedbackScore;
$results .= "Feedback score : $feedbackScore <br />";
//Calculate Feedback %
$posCount = $resp->FeedbackHistory->UniquePositiveFeedbackCount;
$negCount = $resp->FeedbackHistory->UniqueNegativeFeedbackCount;
// PHP inbuilt Function 'sprintf()' — Return a formatted string
$posFeedBackPct = sprintf("%01.1f", (100 * ($posCount / ($posCount + $negCount))));
$results .= "Positive feedback : $posFeedBackPct%<br />";
// PHP inbuilt Function 'substr()' — Return part of a string
//$regDate = substr($resp->User->RegistrationDate, 0, 10);
//$results .= "Registration date : $regDate<br />";
$results .= "</tr></table>";
}else {
$results = "<h3> No user profile for seller $idOfSeller";
}
$this->details = $results;
//return $results;
}
// function setProperty($idOfSeller,$globalID,$debug){
//
// $this->sellerName = $idOfSeller;
// $this->siteID = $globalID;
// $this->debug = $debug;
//
}
function __toString()
{
// TODO: Implement __toString() method.
return $this->details;
}
}