2013-05-13 6 views
8

SOAP APIを使用してmagento製品のカスタム属性の値を取得しようとしています。私は標準的な属性値しか取得できません。私は以下のコードで試していますが、それは動作しないようです。 //出力SOAP APIを使用してmagentoでカスタム属性の値を取得する方法

object(stdClass)[4] 
    public 'product_id' => string '3230' (length=4) 
    public 'sku' => string 'test101' (length=7) 
    public 'set' => string '9' (length=1) 
    public 'type' => string 'simple' (length=6) 
    public 'categories' => 
    array (size=0) 
     empty 
    public 'websites' => 
    array (size=1) 
     0 => string '1' (length=1) 
    public 'created_at' => string '2013-05-12 23:07:33' (length=19) 
    public 'updated_at' => string '2013-05-13 04:54:50' (length=19) 
    public 'type_id' => string 'simple' (length=6) 
    public 'name' => string 'test' (length=4) 
    public 'description' => string 'asd' (length=3) 
    public 'short_description' => string 'asd' (length=3) 
    public 'weight' => string '123.0000' (length=8) 
    public 'status' => string '1' (length=1) 
    public 'url_key' => string 'test' (length=4) 
    public 'url_path' => string 'test.html' (length=9) 
    public 'visibility' => string '3' (length=1) 
    public 'category_ids' => 
    array (size=0) 
     empty 
    public 'has_options' => string '0' (length=1) 
    public 'price' => string '11.0000' (length=7) 
    public 'tax_class_id' => string '0' (length=1) 
    public 'tier_price' => 
    array (size=0) 
     empty 
    public 'options_container' => string 'container2' (length=10) 
    public 'enable_googlecheckout' => string '1' (length=1) 
Method 2 I tried. 
$ebay = $proxy->catalogProductInfo($sessionId, $sku,1,array('ebay_available_qty')); 
var_dump($ebay); 

//gives same output 

$user = 'user'; 
$password = 'pass'; 
$proxy = new SoapClient('http://asd.com.au/api/v2_soap?wsdl'); 
$sessionId = $proxy->login($user, $password); 

    //method 1 I tried 
    $ebayStock = new stdClass(); 
    $ebayStock->key = 'ebay_available_qty'; 
    $additionalAttributes['single_data'][] = $ebayStock ; 
    $ebay = $proxy->catalogProductInfo($sessionId, $sku,1,$additionalAttributes); 
    var_dump($ebay); 

私は、属性 "ebay_available_qty" の値を取得しようとしています。

よろしく Abnab

答えて

14

が最後にそれを自分自身を修正しました。ちょうど新しいstdClass()を作成し、私が配列に欲しい属性をそれに入れました。

$ebayStock = new stdClass(); 
$ebayStock->additional_attributes = array('ebay_available_qty'); 

$ebay = $proxy->catalogProductInfo($sessionId, $sku,null,$ebayStock); 
+0

保存した私の日!素晴らしい答え! – Horen

+0

ありがとうございました、これは私を夢中にさせてくれました! – Pete855217

+0

@ Pete855217いいえ心配:) – abnab

関連する問題