我正在尝试将会员参数添加到我的脚本中以在 ebay 上查找项目,但我不明白我可以在哪里放置会员跟踪 ID 等
我正在尝试在服务请求$service = new ServicesFindingService
后添加联盟活动 ID,但这不起作用。
require 'vendor/autoload.php';
use DTSeBaySDKConstants;
use DTSeBaySDKFindingServices;
use DTSeBaySDKFindingTypes;
$config = require 'configuration.php'; // Get configuration.php file
$service = new ServicesFindingService(array(
'appId' => $config['ebay']['production']['appId'],
'apiVersion' => $config['ebay']['findingApiVersion'],
'globalId' => ConstantsGlobalIds::IT
));
$request = new TypesFindItemsByKeywordsRequest();
$words = isset($_GET['search']) ? $_GET['search'] : "";
$request->keywords = $words;
$request->paginationInput = new TypesPaginationInput();
$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: %sn", $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';
}
}
}
}
}
通过请求的关联字段指定您的详细信息。
$request->affiliate = new TypesAffiliate();
$request->affiliate->customId = '...';
$request->affiliate->geoTargeting = true;
$request->affiliate->networkId = 2;
$request->affiliate->trackingId = '...';