4

According to the API Docs, one can specify an array of attributes as a parameter when retrieving a product. What is the purpose in that?

2

The parameter attributes (it's a Array of catalogProductRequestAttributes) It is used to define which attributes about a product to retrieve in request response.

Note that the additional attributes will be returned in through the associative array named additional_attributes in catalogProductReturnEntity.

Example to retrive just product title, description, short description and price attributes.

// connect to soap server
$client = new SoapClient('http://magentoinstall.local/api/v2_soap?wsdl=1');

// log in
$session = $client->login('user', 'pass');

// product info
$attributes = new stdclass();
$attributes->attributes = array('product_title', 'description', 'short_description', 'price');
$productInfo = $client->catalogProductInfo($session, 'sku', NULL, $attributes);

Doing an analogy with Magento Collections, this has an effect similar to addAttributeToSelect() method.

  • when you create products, you can add attribute sets to them. How do I access the attributes and attribute values for a product? – Kevin Wu Jan 20 '16 at 1:39
  • You can retrieve this via catalogProductAttributeList method: magentocommerce.com/api/soap/catalog/catalogProductAttribute/… – Denis Spalenza Jan 21 '16 at 2:39
  • yes, but that does not give me the attributes for one product. It gives me all attributes in the store. – Kevin Wu Jan 21 '16 at 3:06
  • Could you tell me how to retrieve the label from an attribute that is populated from a dropdown? I can get the ID of the dropdown option from the method you mentioned, but not the descriptive label. (i.e - product_type is returning '5' and not 'Magazine') – richelliot Feb 6 '17 at 16:38
  • @DenisSpalenza can i get help magento.stackexchange.com/q/263298/57334 – zus Feb 27 '19 at 10:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.