php - How do I pull the product cost with Magento API via SOAP? -


i trying pull product's cost using catalogproductinfo command...i pull product data, not include product's cost. api call return product cost?

this how tried

<?php ini_set("display_errors",1);  $productid = '166';  $proxy = new soapclient('http://localhost/magento/index.php/api/v2_soap/?wsdl');  $sessionid = $proxy->login('username','password');  $attributes=array();  $attributes['additional_attributes']=array('cost');  $result = $proxy->catalogproductinfo($sessionid,'166',null,(object)$attributes);  echo "<pre>";print_r($result);echo "</pre>";  ?> 

and response got

stdclass object ( [product_id] => 166 [sku] => htc touch diamond [set] => 38 [type] => simple [categories] => array     (         [0] => 8     )  [websites] => array     (         [0] => 1     )  [created_at] => 2008-07-24t19:22:13-07:00 [updated_at] => 2014-03-12 11:09:55 [type_id] => simple [name] => htc touch diamond  [weight] => 0.3000 [status] => 1 [url_key] => htc-touch-diamond [url_path] => htc-touch-diamond.html [visibility] => 4 [has_options] => 0 [gift_message_available] =>   [price] => 750.0000 [tax_class_id] => 2 [tier_price] => array     (     )  [meta_title] =>   [meta_keyword] =>   [meta_description] =>   [custom_design] =>   [custom_layout_update] =>   [options_container] => container2 [additional_attributes] => array     (         [0] => stdclass object             (                 [key] => cost                 [value] => 300.0000             )      )      ) 

try on stand alone php file own parameters

pass rest of attributes require under additional attributes

    $attributes['additional_attributes']=array('cost','anything'); 

there 2 kinds of attributes, attributes & additional_attributes, should pass them in array

    $attributes['additional_attributes']=array('cost'); 

or

    $attributes['attributes']=array('attribute_code'); 

for more info please refer info method of below class

    mage_catalog_model_product_api_v2  

to return these values default looks have deal wsi.xml , api2.xml on catalog module, little complex way it.i'd suggest approach.

hope helps


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -