';
// echo 'SESSION:
';
// print_r($_SESSION);
// echo 'PARAMS:
';
// print_r($params);
// echo '';
if ( isset($_GET['sid']) && !isset($_SESSION['search_id']) ) {
$search_id = intval($_GET['sid']);
// echo 'here13'."
";
include 'ebayflop/runapi.php';
} elseif ( isset($_SESSION['search_id']) ) {
// echo 'here2'."
";
$search_id = $_SESSION['search_id'];
include 'ebayflop/runapi.php';
} else {
// echo 'here3'."
";
echo '
Search eBay
';
include 'ebayflop/searchform.php';
include 'footer.php';
exit;
}
// if ( $_SERVER['REMOTE_ADDR'] == '71.208.247.193' ) {
// echo '
/results.html line 27 apicall: '.str_replace('&','
&',$apicall).'
';
// exit;
// }
if ( !isset($_GET['page']) ) {
$page = 1;
} elseif ( isset($_GET['page']) && is_numeric($_GET['page']) ) {
$page = intval($_GET['page']);
$apicall .= '&paginationInput.pageNumber='.$page;
}
// echo 'apicall on results.html:
';
// echo str_replace('&','
&',$apicall);
// echo '
';
$resp = simplexml_load_file($apicall);
// echo '';
// print_r($resp);
// echo '
';
if ( $_SERVER['REMOTE_ADDR'] == '67.142.112.181' ) {
// echo '';
echo 'apicall:
'.str_replace('&','
&',$apicall).'
';
// print_r($resp);
// echo '
';
}
if ($resp && $resp->ack == 'Success') {
// include 'results.php';
// $_SESSION["$resp"] = $resp;
} elseif ($resp && $resp->ack != 'Success') {
echo 'Sorry, there was a problem. Please try again...
';
// echo 'resp error: '.$resp->errorMessage->error->message;
// trigger_error('resp error: '.$resp->errorMessage->error->message.'
'.str_replace('&',"\n".'&',$apicall));
// include 'footer.php';
// exit;
} elseif ( !$resp) {
echo 'Sorry, we failed to receive a response from ebay';
}
// if ( $_SERVER['REMOTE_ADDR'] == '71.208.247.193' ) {
// echo $_SERVER['REMOTE_ADDR'];
// if (isset($_SESSION['thezip']) ) {
// echo 'session thezip: '.$_SESSION['thezip'].'
';
// }
// }
$toggleprice = '';
$priceord = '';
$toggletime = '';
$results = '';
$timeornewly='';
$timeord = '';
// $results .= ''.$displayforsale.'For Sale At E-bay Now
';
// if ($resp && $resp->ack == 'Success' && $resp->searchResult->count > 0) {
// echo ''.$resp->searchResult['count'].' items found
';
// $itemstotal = $resp->searchResult['entries'];
$itemstotal = $resp->paginationOutput->totalEntries;
$itemsperpage = $resp->paginationOutput->entriesPerPage;
// $itemsthispage = $resp->paginationOutput->entriesPerPage;
$pagestotal = $resp->paginationOutput->totalPages;
if ( $pagestotal > 100 ) {
$pagestotal = 100;
}
$thispage = $resp->paginationOutput->pageNumber;
// echo 'Showing '.$resp->searchResult['count'].' items found
';
if ( $resp->paginationOutput->totalEntries == 0 ) {
// echo 'NO RESULTS';
// $results = 'Sorry, no items were found. You might want to try searching again with broader or different search criteria.
» Refine Your Search
';
// $results = 'Sorry, no items were found. You might want to try searching again with broader or different search criteria.
» Refine Your Search
';
}
?>
Suggested searches: '. $suggested.'';
} else {
$suggestions = '';
}
if ( $itemstotal == 0 ) {
// $results = 'Sorry, no items were found. You might want to try searching again with broader or different search criteria. Refine Your Search »
';
$results = 'Search Results
';
$results .= 'Sorry, no items were found. You might want to try searching again with broader or different search criteria:
';
$results .= $suggestions;
}
if ( $itemstotal > 0 ) {
// pagination table
$results .= '';
$results .= $searchagain;
if ( isset($displayforsale) ) {
$results .= '
'.$displayforsale.' Available on eBay Now
';
} else {
$results .= '
Search Results
';
}
if ( isset($_POST['L6C']) || ( isset($params['params']['L6C']) && !isset($_POST['catposted']) ) ) {
$CatBread = isset($_POST['L6C']) ? ed($_POST['L6C']) : ed($params['params']['L6C']);
$Level = 6;
}
if ( isset($_POST['L5C']) || ( isset($params['params']['L5C']) && !isset($_POST['catposted']) ) ) {
$CatBread = isset($_POST['L5C']) ? ed($_POST['L5C']) : ed($params['params']['L5C']);
$Level = 5;
} elseif ( isset($_POST['L4C']) || ( isset($params['params']['L4C']) && !isset($_POST['catposted']) ) ) {
$CatBread = isset($_POST['L4C']) ? ed($_POST['L4C']) : ed($params['params']['L4C']);
$Level = 4;
} elseif ( isset($_POST['L3C']) || ( isset($params['params']['L3C']) && !isset($_POST['catposted']) ) ) {
$CatBread = isset($_POST['L3C']) ? ed($_POST['L3C']) : ed($params['params']['L3C']);
$Level = 3;
} elseif ( isset($_POST['L2C']) || ( isset($params['params']['L2C']) && !isset($_POST['catposted']) ) ) {
$CatBread = isset($_POST['L2C']) ? ed($_POST['L2C']) : ed($params['params']['L2C']);
$Level = 2;
} elseif ( ( isset($_POST['RootID']) && $_POST['RootID'] != '-1' ) || ( isset($params['params']['RootID']) && $params['params']['RootID'] != '-1' ) ) {
$CatBread = isset($_POST['RootID']) ? ed($_POST['RootID']) : ed($params['params']['RootID']);
$Level = 1;
}
if ( isset($CatBread) && $CatBread != '' ) {
$breadcrumb = makebreadcrumb($CatBread, $Level);
$searching = '
Searching: '. $breadcrumb.'';
$results .= $searching;
}
if ( strlen($words) > 0 ) {
$results .= '
Search terms: ';
}
if ( isset($allwordsfriendly) ) {
$results .= ' All words: '.$allwordsfriendly;
}
if ( isset($anywordsfriendly) ) {
$results .= ' Any words: '.$anywordsfriendly;
}
if ( isset($phrasefriendly) ) {
$results .= ' As a phrase: "'.$phrasefriendly.'"';
}
if ( isset($excludewordsfriendly) ) {
$results .= ' Exclude words: '.$excludewordsfriendly;
}
if ( strlen($words) > 0 ) {
$results .= '';
}
if ( isset($suggested) ) {
$results .= $suggestions;
}
$pagetable = '
';
$pagetable .= '| '.number_format((float)$itemstotal,0).' item(s) found | ';
$pagetable .= '';
include 'ebayflop/paginate.php';
// $results .= ' ('.$itemsperpage.' per page)';
$pagetable .= ' | ';
$pagetable .= '
';
$results .= $pagetable;
// begin main table
$results .= '
';
$results .= ' | | Price | Shipping | Total | Listing Ends |
'."\n";
// $results .= '| |
';
// If the response was loaded, parse it and build links
foreach($resp->searchResult->item as $item) {
if ($item->galleryURL) {
$picURL = $item->galleryURL;
$picURL = str_replace('8080_1.jpg','4040_1.jpg',$picURL);
$picURL = str_replace('http:','https:',$picURL);
} else {
$picURL = "https://pics.ebaystatic.com/aw/pics/express/icons/iconPlaceholder_96x96.gif";
}
$itemid = $item->itemId;
$title = htmlspecialchars($item->title);
$titleforlink = urlencode($item->title);
$link = $item->viewItemURL;
$link = str_replace('toolid=0','toolid=10013',$link);
$link = urlencode($link);
// $link .= '&itemid='.$itemid.'&itemTitle='.$titleforlink;
$ebayhref = '';
// $pathparts = pathinfo($_SERVER['SCRIPT_NAME']);
// $basename = $pathparts['filename'];
// $myhref = '';
// forward:
// /ebayproducts.html?sid=&page=&itemid=&rp=
// to
// /ebayproducts.html?dest='.$link.'&itemid='.$itemid.'&itemTitle='.$titleforlink
$myhref = $ebayhref;
// $watchlink = 'https://rover.ebay.com/rover/1/711-37018-2978-0/1?campid='.$campid.'&customid='.$customid.'&loc=http%3A%2F%2Fcgi1.ebay.com%2Fws%2FeBayISAPI.dll%3FMfcISAPICommand%3DMakeTrack%26item%3D'.$itemid.'%26ssPageName%3DRSS%3AB%3ASRCH%3AUS%3A104';
if ($item->subtitle) {
$subtitle = ''.$item->subtitle;
} else {
$subtitle = '';
}
$listingtype = $item->listingInfo->listingType;
$bidcount = $item->sellingStatus->bidCount;
$location = '';
if ( isset($item->postalCode) && $item->postalCode != '' ) {
$location = 'ZIP '.$item->postalCode.', ';
}
$location .= $item->location;
$itemcategory = $item->primaryCategory->categoryName;
$price = $item->sellingStatus->convertedCurrentPrice;
$buynowavailable = $item->listingInfo->buyItNowAvailable;
$buyitnowprice = $item->listingInfo->convertedBuyItNowPrice;
$bestofferenabled = $item->listingInfo->bestOfferEnabled;
$sellerid = $item->sellerInfo->sellerUserName;
$sellerstar = $item->sellerInfo->feedbackRatingStar;
$sellerfb = $item->sellerInfo->feedbackScore;
$sellerfbpc = $item->sellerInfo->positiveFeedbackPercent;
$shiptype = $item->shippingInfo->shippingType;
if ( isset( $item->shippingInfo->shippingServiceCost ) ) {
$shipcost = $item->shippingInfo->shippingServiceCost;
} else {
$shipcost = false;
}
$timeleft = $item->sellingStatus->timeLeft;
$timeleft = getPrettyTimeFromEbayTime($timeleft);
$endtime = strtotime($item->listingInfo->endTime); // returns Epoch seconds
// $end = date("m/d/y g:i a",$endTime);
$enddate = date("m/d/y",$endtime);
$endtime = date("g:i a",$endtime);
if ( $shiptype == 'Free' ) {
$total = (float)$price;
$total = number_format((float)$total,2);
} elseif ( $shiptype == 'Flat' || $shiptype == 'FlatDomesticCalculatedInternational' ) {
$total = (float)$price + (float)$shipcost;
$total = number_format((float)$total,2);
} elseif ( $shiptype == 'Calculated' ) {
$total = (float)$price + (float)$shipcost;
$total = number_format((float)$total,2);
} else {
$total = (float)$price . ' plus shipping';
$total = number_format((float)$total,2);
}
// $ship is dispayed in "shipping" column
// $shiptext is appended to "total cost" column"
if ( $shiptype == 'Free' || ( ($shiptype == 'Flat' || $shiptype == 'FlatDomesticCalculatedInternational' || $shiptype == 'FreightFlat' ) && $shipcost != false && intval($shipcost) == 0) ) {
$ship = 'Free
Shipping';
$shiptext = '';
} elseif ( ( $shiptype == 'Flat' || $shiptype == 'FreightFlat' ) && $shipcost != false ) {
$ship = '$'.number_format((float)$shipcost,2);
$shiptext = ' incl. shipping';
$shiptext = '';
} elseif ( ( $shiptype == 'Calculated' || $shiptype == 'FlatDomesticCalculatedInternational') && ( isset($shipcost) && $shipcost != false) ) {
if ( $shipcost == '0.0' ) {
$ship = 'Free Shipping';
$shiptext = '';
} elseif ( $shipcost != '0.0' && $shipcost != false ) {
$ship = '$'.number_format((float)$shipcost,2);
$shiptext = '';
}
} elseif ( ( $shiptype == 'Calculated' || $shiptype == 'CalculatedDomesticFlatInternational') && ( isset($shipcost) && $shipcost != false) ) {
$ship = 'Calculated';
$shiptext = ' plus shipping';
} elseif ( $shiptype == 'NotSpecified' ) {
$ship = 'Shipping Not Specified';
$shiptext = ' plus shipping';
} elseif ( $shiptype == 'Freight' ) {
$ship = 'Freight';
$shiptext = ' plus shipping';
} elseif ( $shiptype == 'Free' && isset($shipcost) && floatval($shipcost) == 0 ) {
$ship = '$'.number_format((float)$shipcost,2);
$shiptext = '';
} elseif ( $shiptype == 'FreePickup') {
$ship = 'Free Pickup';
$shiptext = '';
} else {
$ship = '';
$shiptext = ' plus shipping';
}
// if ( $shiptype == 'Free' || ( ( $shiptype == 'Calculated' && isset($shipcost) && $shipcost == 0 ) ) ) {
if ( $shiptype == 'Free'
|| ($shiptype == 'FlatDomesticCalculatedInternational' && $shipcost == '0.0')
|| ($shiptype == 'Calculated' && $shipcost == '0.0')
|| ($shiptype == 'Flat' && $shipcost == '0.0')
) {
$freeimg = '
';
} else {
$freeimg = '';
}
// $ebayhref = '';
// $pathparts = pathinfo($_SERVER['SCRIPT_NAME']);
// $basename = $pathparts['filename'];
// $myhref = '';
// $myhref = $ebayhref;
if ( $bestofferenabled == 'true' ) {
$bestoffer = ''.$ebayhref.'Make An Offer';
} else {
$bestoffer = '';
}
// $watchit = ' Watch this item on eBay';
/////// START item
$results .= '';
$results .= $myhref.' ';
$results .= ' '.$freeimg;
// $results .= ' shiptype: '.$shiptype;
// $results .= ' shipcost: '.$shipcost;
if ( $buynowavailable == 'true' || $listingtype == 'AuctionWithBIN' || $listingtype == 'FixedPrice' || $listingtype == 'StoreInventory' ) {
$binbtn = ''.$ebayhref.'» Buy It Now ';
$results .= $binbtn;
}
if ( $listingtype == 'Auction' || $listingtype == 'AuctionWithBIN' ) {
$binbtn = ''.$ebayhref.'» Bid Now ';
$results .= $binbtn;
}
// $results .= ' LISTING TYPE: '.$listingtype.' ';
// if ( $listingtype == 'Auction' ) {
// $results .= ' >!!!!!!AUCTION!!!!!!!!!';
// }
// if ( $listingtype == 'AuctionWithBIN' ) {
// $results .= '';
if ( isset($subtitle) ) {
$results .= ''.$subtitle.'';
}
$results .= ' |
';
$results .= '';
$results .= ''; // START
$results .= 'Listing Type: '.$ebaylistingtypes["$listingtype"];
if ( $listingtype == 'Auction' || $listingtype == 'AuctionWithBIN' ) {
$results .= ' Bids: '.$bidcount;
}
$results .= ' Category: '.$itemcategory;
$results .= ' Item Location: '.str_replace(',',', ',$location);
if ( $shiptype == 'FlatDomesticCalculatedInternational' ) {
$shiptype2 = 'Flat Rate (within U.S.) (International Calculated)';
$shiptype2 .= ' $'.number_format((float)$shipcost,2).' ';
} elseif ( $shiptype == 'Flat' ) {
$shiptype2 = 'Flat Rate $'.number_format((float)$shipcost,2);
} elseif ( $shiptype == 'Calculated' ) {
$shiptype2 = 'Calculated based on ZIP code';
if ( isset($shipcost) && isset($_SESSION['thezip']) ) {
$shiptype2 .= ' $'.number_format((float)$shipcost,2).' ';
}
} else {
$shiptype2 = $shiptype;
}
$results .= ' Ships: '.$shiptype2;
if ( isset($item->ItemSpecifics) ) {
foreach( $item->ItemSpecifics->NameValueList as $key => $val ) {
$results .= ' '.$val->Name.': '.$val->Value;
}
}
$results .= ' | $'.number_format((float)$price,2).' | ';
$results .= ''.$ship.' | ';
$results .= '$'.$total.' '.$shiptext.' | ';
$results .= '';
$results .= 'Ends In: '.$timeleft;
$results .= ' On Date: '.$enddate.' '.$endtime;
$results .= ' | ';
$results .= '
';
$results .= '';
$results .= '';
$results .= '';
$results .= '- '.$myhref.'More Info
';
// $results .= $watchit;
if ( $listingtype == 'Auction' || $listingtype == 'AuctionWithBIN' ) {
$results .= '- '.$ebayhref.'Bid Now'.''. ' (Current or Minimum Bid: $'.number_format((float)$price,2).')
';
}
// if ( $buynowavailable == 'true' || $listingtype == 'AuctionWithBIN' || $listingtype == 'FixedPrice' || $listingtype == 'StoreInventory' ) {
// $results .= '- '.$ebayhref.'Buy It Now'.'
';
// }
// if ( $listingtype == 'Auction' || $listingtype == 'AuctionWithBIN' ) {
// $binbtn = ''.$ebayhref.'» Bid Now ';
// $results .= $binbtn;
// }
if ( $buynowavailable == 'true' || $listingtype == 'AuctionWithBin' || $listingtype == 'FixedPrice' || $listingtype == 'StoreInventory' ) {
if ( $buynowavailable == 'true' ) {
$results .= '- '.$ebayhref.'Buy It Now: $'.number_format((float)$buyitnowprice,2).'';
} elseif ( $listingtype == 'AuctionWithBIN' ) {
$results .= '
- '.$ebayhref.'Buy It Now: $'.number_format((float)$buyitnowprice,2).'';
} elseif ( $listingtype == 'FixedPrice' || $listingtype == 'StoreInventory' ) {
$results .= '
- '.$ebayhref.'Buy It Now: $'.number_format((float)$price,2).'';
}
if ( isset($shipcost) && floatval($shipcost) == 0 ) {
// $results .= ' (free shipping)';
$results .= '';
} elseif ( $shiptype == 'Calculated' ) {
$results .= '
(plus $'.number_format((float)$shipcost,2).' shipping';
if ( isset($_SESSION['thezip']) ) {
$results .= ' to Zip Code '.$_SESSION['thezip'];
}
$results .= ')';
} elseif ( $shiptype == 'Freight' ) {
$results .= ' (plus freight shipping)';
} else {
$results .= ' (plus '.$ship.' shipping)';
}
$results .= ' ';
}
if ( $bestofferenabled == 'true' ) {
$results .= $bestoffer;
}
$results .= ' ';
$results .= ' | ';
$results .= '';
$results .= 'Seller: '.$sellerid;
$starimg = '';
if ( isset($sellerstar) && $sellerstar != 'None' ) {
$sellerstar = $sellerstar;
$starimg = ' ';
}
$results .= $starimg;
$results .= ' Feedback: '.number_format((float)$sellerfb) .' '.$sellerfbpc.'%';
$results .= ' |
';
////// END item
}
$results .= '
';
$results .= $pagetable;
$results .= '
'; // end the enclosing div
} else { // end if itemstotal > 0
if ( isset($_POST['searchsubmitted']) ) {
// $results = "Sorry, no items were found. You might want to try searching again with broader search criteria.
";
$results = 'Sorry, no items were found. You might want to try searching again with broader or different search criteria.
» Refine Your Search
';
} else {
// $results = '';
}
}
// $priceRangeMin = $priceRangeMax; // set up for next iteration
echo $results;
// include 'ebayflop/getthecats.php';
// echo 'before search form';
echo 'Refine Your Search, or Search Again:
';
include 'ebayflop/searchform.php';
// echo 'after search form';
echo '
';
// echo '
//
// ';
include 'footer.php';
?>