ebay api没有得到sku

时间:2014-04-03 10:48:03

标签: php sql api ebay

我正在尝试使用

将我在ebay上的所有商品下载到我的数据库中
$client = new eBaySOAP($session);
$ebay_items_array = array();
try {
    $client = new eBaySOAP($session);

    $params = array(
        'Version' => $Version,
        'GranularityLevel' => "Fine",
        'OutputSelector' => "ItemID,SKU,Title",
        'EndTimeFrom' => date("c", mktime(date("H"), date("i")+10, date("s"), date("n"), date("j"), date("Y"))),
        'EndTimeTo' => date("c", mktime(date("H"), date("i"), date("s"), date("n"), date("j")+120, date("Y"))),
                            'Pagination' => array(
                    'PageNumber' => $_GET['linkebaynum'],
                    'EntriesPerPage' => "20"
                    )
        );
    $results = $client->GetSellerList($params);
    if($results->Ack == "Success")
    {
    $c = 0;
        if(is_array($results->ItemArray->Item))
        {
            foreach($results->ItemArray->Item as $key => $value)
            {

                array_push($ebay_items_array, $value->ItemID);

          $Qcheck = tep_db_query('select ebay_productstoitems_items_id from ' . TABLE_EBAY_PRODUCTS_TO_ITEMS . ' where ebay_productstoitems_items_id = ' . $value->ItemID);

              $check = tep_db_fetch_array($Qcheck);
              if($check == 0) {
              if($check['ebay_productstoitems_items_id'] = $value->ItemID) { 
              echo 'Not in Database - Inserting ' . $value->ItemID . '<br>';
              tep_db_query("insert ebay_productstoitems set ebay_productstoitems_items_id = '" . $value->ItemID . "'");
           }
           }else{
          echo 'Found  - ' . $value->ItemID . ' Nothing to Change<br>';
          tep_db_query("update ebay_productstoitems set ebay_productstoitems_items_id = '" . $value->ItemID . "' where ebay_productstoitems_items_id = '" . $value->ItemID . "'");
          }
            }
            $c++;
        }
    }

} catch (SOAPFault $f) {
    print "error<br>";
}

print "Request:<br>".ebay_formatxmlstring($client->__getLastRequest())."<br><br>";
print "Response:<br>".ebay_formatxmlstring($client->__getLastResponse())."<br><br>";

但它无法恢复SKU(或CustomLabel) 任何人解释我缺少的东西,以便将SKU与itemid一起放入数据库。

或者我是否必须恢复ItemID列表然后再执行第二次以恢复SKU或CustomLabel。

1 个答案:

答案 0 :(得分:0)

发现问题是Sandbox似乎没有通过SKU。我切换到了现场网站,并且他们正在检索SKU以及Itemid。