Most Watched Items on eBay

  • Choose a category below, OR
0 ) { $table = 'ebaycats'; $site = 'EBAY-US'; } else { $checkitquery = " SELECT * FROM ebaymotors WHERE CategoryID = $myCatID LIMIT 1 "; // echo $myquery; $check = mysqli_query($fepdb,$checkitquery) or trigger_error('Bad myquery: '.mysqli_error($fepdb)); if ( $check && mysqli_num_rows($check) > 0 ) { $table = 'ebaymotors'; $site = 'EBAY-MOTOR'; } else { $table = 'ebaycats'; $site = 'EBAY-US'; } } } else { $table = 'ebaycats'; $site = 'EBAY-US'; } if ( isset($_REQUEST['use']) && $_REQUEST['use'] == 'ebaymotors' ) { $table = 'ebaymotors'; $site = 'EBAY-MOTOR'; } // echo 'catid: '.$CatID; include 'ebayflop/choosecat.php'; // echo '
';
// print_r($_SESSION);
// print_r($_GET);
// print_r($_POST);
// print_r(get_defined_vars()); 
// echo '
'; // $where = " WHERE CategoryID NOT IN (2038,10159, 3252, 10542, 31411 ) ORDER BY RAND() "; if ( isset($_REQUEST['CatID']) ) { $myCatID = $_REQUEST['CatID']; // echo '1'; } elseif ( isset($L6C) ) { $myCatID = $L6C; // echo '2'; } elseif ( isset($L5C) ) { $myCatID = $L5C; // echo '3'; } elseif ( isset($L4C) ) { $myCatID = $L4C; // echo '4'; } elseif ( isset($L3C) ) { $myCatID = $L3C; // echo '5'; } elseif ( isset($L2C) ) { $myCatID = $L2C; // echo '6'; } elseif ( isset($RootID) ) { $myCatID = $RootID; // echo '
7
'; } elseif ( isset($myCatID) ) { // echo '
8
'; } // echo 'catid: '.$myCatID; if ( isset($myCatID) ) { $israndom = 'notrandom'; $where = " WHERE CategoryID = $myCatID "; } else { $israndom = 'random'; $where = " WHERE CategoryID NOT IN ( 2038,10159, 3252,6000,6051,6049,10540,6040,5353,6048,6044 ) ORDER BY RAND() "; } // echo $CatID; // $where = " WHERE CategoryID = $CatID "; $myquery = " SELECT * FROM $table $where LIMIT 1 "; // echo $myquery; $query = mysqli_query($fepdb,$myquery) or trigger_error('Bad myquery: '.mysqli_error($fepdb)); if ( $query && mysqli_num_rows($query) > 0 ) { $row = mysqli_fetch_assoc($query); $myCatID = $row['CategoryID']; $CatName = $row['CategoryName']; $Level = $row['CategoryLevel']; // echo '
CatName: '.$CatName; // function makebreadcrumb($CatIDToSearch, $Level,$justcats='',$table='ebaycats') { $breadcrumb = makebreadcrumb($myCatID, $Level,'',$table); } else { // end if query $CatName = ''; $breadcrumb = ''; } // $url = 'http://open.api.ebay.com/shopping'; // URL to call $url = 'https://svcs.ebay.com/MerchandisingService'; // URL to call $i = 1; // . "&TrackingPartnerCode=9" // fill in your information in next 3 lines // . "&trackingid=$campid" // this is my CJ PID - no NEW eBay ePN campaign id // . "&affiliateuserid=$customid" // this is my own custom id // unique id for custom id $thetime = time(); $myunique = uniqid().'-'.$thetime; $apicall = "$url?SERVICE-NAME=MerchandisingService" . "&OPERATION-NAME=getMostWatchedItems" . "&SERVICE-VERSION=1.4.0" . "&CONSUMER-ID=$AppID" . "&RESPONSE-DATA-FORMAT=XML" . "&GLOBAL-ID=$site" . "&affiliate.networkId=9" . "&affiliate.trackingId=".$campid // this is my eBay ePN campaign id . "&affiliate.customId=".$myunique // this is my eBay ePN custom page id . "&categoryId=".$myCatID . "&maxResults=50" ; $resp = simplexml_load_file($apicall); if ( $_SERVER['REMOTE_ADDR'] == '71.3.162.253' ) { // echo '
';
		// print_r($resp);
		// echo '
'; } if ( $resp->ack == 'Failure' || count($resp->itemRecommendations->item) < 1 ) { if ( $israndom == 'random' ) { header("location: ".$_SERVER['REQUEST_URI']); exit; } header( "HTTP/1.0 404 Not Found" ); // include 'header.php'; echo '

Sorry

'; echo '

No most-watched items in the category '.$breadcrumb.'.

'; include 'footer.php'; exit; } elseif ( $resp->ack == 'Success') { // echo '
'; // echo 'apicall: '.$apicall; // prearray($resp); $searching = ''. $breadcrumb.''; echo '

Most Watched Items in '.$searching.'

'; // echo $searching; echo '
'; echo '
    '; foreach($resp->itemRecommendations->item as $item) { $picURL = $item->imageURL; // $picURL = str_replace('8080_1.jpg','4040_1.jpg',$picURL); $picURL = str_replace('80.jpg','140.jpg',$picURL); $picURL = str_replace('http:','https:',$picURL); $link = '/products.php?itemid='.$item->itemId.'&itemTitle='.urlencode($item->title); echo '
  • '; // echo ''.$item->title.'
    '; echo ''; // echo $picURL; echo ''.$item->title.'
    '; if ( isset($item->subtitle) ) { echo $item->subtitle .'
    '; } if ( isset($item->watchCount) ) { echo number_format((float)$item->watchCount,0) .' watchers'; } if ( isset($item->bidCount) ) { echo ' - Bids: '.$item->bidCount; } if ( isset($item->currentPrice) ) { echo ' - Current Bid: $'.number_format((float)$item->currentPrice,2); } echo ' - Time left: '.getPrettyTimeFromEbayTime($item->timeLeft); if ( isset($item->buyItNowPrice) ) { echo '
    Buy It Now: $'.number_format((float)$item->buyItNowPrice,2).''; } if ( isset($item->shippingCost) ) { echo '
    Shipping: $'.number_format((float)$item->shippingCost,2); } // if ( isset($item->primaryCategoryName) ) { // echo '
    In Category: '.$item->primaryCategoryName; // } // echo '
    '.$item->primaryCategoryName; echo '
  • '; } echo '
'; echo '
'; // prearray($item); // prearray($resp); // exit; // $theitem = $item->RelatedSearches; // $items = explode(';',$theitem); // if ( count($items) > 0 ) { // echo '

'.$resp->PopularSearchResult->CategoryName.'

'; // echo '
    '; // foreach( $items as $key => $val ) { // echo '
  • '; // echo ''.$val.''; // echo '
  • '; // // } // echo '
'; // } // } // end foreach // } // if ( $i == 2 ) { // echo '
'; // } // $i++; // echo '
'; // } // END for each // $apicall2 = "$url?callname=FindPopularItems" // . "&responseencoding=$respenc" // . "&appid=$AppID" // . "&siteid=$siteID" // . "&version=551" // . "&QueryKeywords=".urlencode($val) // ; // echo str_replace('&','
&',$apicall2); // // $resp2 = simplexml_load_file($apicall2); // // if ( $resp2->Ack == 'Failure' ) { // prearray($resp2); // header( "HTTP/1.0 404 Not Found" ); // // include 'header.php'; // echo '

Sorry

'; // echo '

That item was not found.

'; // include 'footer.php'; // exit; // } // // if ($resp2) { // prearray($resp); // // foreach($resp->Item as $item) { // // $ItemTitle = $resp->Item->PictureURL; // // $link = $resp->Item->ViewItemURLForNaturalSearch; // // } // // $itemtitle = $resp->Item->Title; // // } ?>