2017-06-16 139 views
0

我正在tryng到子公司參數添加到我的劇本在eBay上找項目,但我不明白的地方我可以把子公司trackindId等易趣SDK和聯盟

我正在tryng補充附屬系列ID後服務請求$ service = new Services \ FindingService但不起作用。

任何幫助都非常讚賞

require 'vendor/autoload.php'; 
     use \DTS\eBaySDK\Constants; 
     use \DTS\eBaySDK\Finding\Services; 
     use \DTS\eBaySDK\Finding\Types; 
     $config = require 'configuration.php'; // Get configuration.php file 

     $service = new Services\FindingService(array(
     'appId' => $config['ebay']['production']['appId'], 
     'apiVersion' => $config['ebay']['findingApiVersion'], 
     'globalId' => Constants\GlobalIds::IT 
     )); 

     $request = new Types\FindItemsByKeywordsRequest(); 

     $words = isset($_GET['search']) ? $_GET['search'] : ""; 
     $request->keywords = $words; 
     $request->paginationInput = new Types\PaginationInput(); 

     $entriesPerPage = 15; // Ebay items on the page 
     $request->paginationInput->entriesPerPage = $entriesPerPage; 

     $pageNum = isset($_GET['page']) ? $_GET['page'] : 1; 
     $request->paginationInput->pageNumber = (int)($pageNum); 
     $response = $service->findItemsByKeywords($request); 

     $responsePages = $response->paginationOutput->totalPages; 
     $currentPages = 20; // Total page: get 20. Maximum: 100 pages 
     $totalEbayPages = min($currentPages, $responsePages); 
     $totalEbayResult = isset($response->paginationOutput->totalEntries) ? $response->paginationOutput->totalEntries : 0; 

     $resultEbay = []; 

     if ($pageNum <= $totalEbayPages) { 
      if ($response->ack !== 'Success') { 
      if (isset($response->errorMessage)) { 
      foreach ($response->errorMessage->error as $error) { 
       printf("Error: %s\n", $error->message); 
    } 
    } 
} else { 
    foreach ($response->searchResult->item as $key => $item) { 
    $resultEbay[$key]['title'] = $item->title; 
    $resultEbay[$key]['viewItemURL'] = $item->viewItemURL; 
    $resultEbay[$key]['galleryURL'] = isset($item->galleryURL) ? $item->galleryURL : '../images/iconPlaceholder_96x96.gif'; 
    $resultEbay[$key]['priceId'] = $item->sellingStatus->currentPrice->currencyId; 
    $resultEbay[$key]['currentPrice'] = $item->sellingStatus->currentPrice->value; 
    $resultEbay[$key]['condition'] = strtolower(isset($item->condition->conditionDisplayName) ? $item->condition->conditionDisplayName : 'other'); 
    $resultEbay[$key]['categoryName'] = isset($item->primaryCategory->categoryName) ? $item->primaryCategory->categoryName : 'none'; 
    $resultEbay[$key]['shipping'] = isset($item->shippingInfo->shippingType) ? $item->shippingInfo->shippingType : 'free'; 
    $resultEbay[$key]['shopName'] = 'at eBay'; 
    if (isset($item->listingInfo->listingType)) { 
     if ($item->listingInfo->listingType == 'Auction') { 
     $resultEbay[$key]['pricing'] = $item->listingInfo->listingType; 
     } else { 
     $resultEbay[$key]['pricing'] = 'Buy Now'; 
     } 
    } 
    } 
} 
} 
+0

@ david-t-sadler你可以幫我嗎? – junkfood

回答

0

通過請求的affiliate field指定您的詳細信息。

$request->affiliate = new Types\Affiliate(); 
$request->affiliate->customId = '...'; 
$request->affiliate->geoTargeting = true; 
$request->affiliate->networkId = 2; 
$request->affiliate->trackingId = '...';