【问题标题】:eBay SDK and AffiliateeBay SDK 和附属公司
【发布时间】:2017-06-16 11:06:03
【问题描述】:

我正在尝试将affiliate 参数添加到我的脚本中以在ebay 上查找项目,但我不明白我可以将affiliate trackingId 等放在哪里

我正在尝试在服务请求 $service = new Services\FindingService 之后添加联属营销活动 ID,但这不起作用。

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';
      }
    }
  }
}
}

【问题讨论】:

    标签: php ebay-api ebay-sdk


    【解决方案1】:

    通过请求的affiliate field 指定您的详细信息。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-05-03
      • 2018-03-09
      • 1970-01-01
      • 1970-01-01
      • 2021-08-02
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多