2013-10-06 70 views
2

我需要使用OpenBay中的opencart擴展功能與eBay馬達站點連接。易趣電機的網站ID是100,但是對於我來說,我無法用這個函數的寫法來改變它,我在這裏錯過了什麼?在易趣API調用中更改siteid

API function call

public function openbay_call($call, array $post = NULL, array $options = array(), $content_type = 'json', $statusOverride = false){ 

     if(defined("HTTPS_CATALOG")){ 
      $domain = HTTPS_CATALOG; 
     }else{ 
      $domain = HTTPS_SERVER; 
     } 

     $data = array(
      'token'    => $this->token, 
      'language'   => $this->config->get('openbay_language'), 
      'secret'   => $this->secret, 
      'server'   => $this->server, 
      'domain'   => $domain, 
      'openbay_version' => (int)$this->config->get('openbay_version'), 
      'data'    => $post, 
      'content_type'  => $content_type 
     ); 

     $defaults = array(
      CURLOPT_POST   => 1, 
      CURLOPT_HEADER   => 0, 
      CURLOPT_URL    => $this->url.$call, 
      CURLOPT_USERAGENT  => "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1", 
      CURLOPT_FRESH_CONNECT => 1, 
      CURLOPT_RETURNTRANSFER => 1, 
      CURLOPT_FORBID_REUSE => 1, 
      CURLOPT_TIMEOUT   => 0, 
      CURLOPT_SSL_VERIFYPEER => 0, 
      CURLOPT_SSL_VERIFYHOST => 0, 
      CURLOPT_POSTFIELDS  => http_build_query($data, '', "&")  
     ); 

     $ch = curl_init(); 
     curl_setopt_array($ch, ($options + $defaults)); 
     if(! $result = curl_exec($ch)){ 
      $this->log('openbay_call() - Curl Failed '.curl_error($ch).' '.curl_errno($ch)); 
     } 
     curl_close($ch); 

     /* There may be some calls we just dont want to log */ 
     if(!in_array($call, $this->noLog)){ 
      $this->log('openbay_call() - Result of : "'.$result.'"'); 
     } 
     /* JSON RESPONSE */ 
     if($content_type == 'json'){ 
      $encoding = mb_detect_encoding($result); 

      /* some json data may have BOM due to php not handling types correctly */ 
      if($encoding == 'UTF-8') { 
       $result = preg_replace('/[^(\x20-\x7F)]*/','', $result);  
      } 

      $result    = json_decode($result, 1); 
      $this->lasterror = $result['error']; 
      $this->lastmsg  = $result['msg']; 

      if(!empty($result['data'])){ 
       return $result['data']; 
      }else{ 
       return false; 
      } 
     /* XML RESPONSE */ 
     }elseif($content_type == 'xml'){ 
      $result    = simplexml_load_string($result); 
      $this->lasterror = $result->error; 
      $this->lastmsg  = $result->msg; 

      if(!empty($result->data)){ 
       return $result->data; 
      }else{ 
       return false; 
      } 
     } 
    }else{ 
     $this->log('openbay_call() - OpenBay not active'); 
     $this->log('openbay_call() - Data: '.serialize($post)); 
    } 
} 

predefined parameters within the class - 可能不幫助,但不管怎麼說包括在內。

public function __construct($registry) { 
    $this->registry  = $registry; 
    $this->token  = $this->config->get('openbaypro_token'); 
    $this->secret  = $this->config->get('openbaypro_secret'); 
    $this->logging  = $this->config->get('openbaypro_logging'); 
    $this->tax  = $this->config->get('tax'); 
    $this->server  = 1; 
    $this->lasterror = ''; 
    $this->lastmsg  = ''; 
} 

the function call

$this->data['test_category_features'] = $this->ebay->openbay_call('listing/getCategoryFeatures/', array('id' => 35618)); 

一切正常,但如何將我得到這個改變SITEID 100,只有這樣我可以計算出來是重新寫我自己的API調用的類,但客戶端支付訂閱openbay並希望通過它們使用API​​調用,所以我必須使用那裏的功能。我試圖返回eBay汽車類別功能,以便他可以按照他多年來的「使用部件」一樣列出它們。如果您沒有切換到eBay馬達站點ID「100」,那麼在嘗試通過opencart擴展將產品添加到eBay時,它不會返回所需的類別變更或更少的類別接受類別。 任何意見將不勝感激,真的卡在這裏!在此先感謝:)

回答