Magento 1.9 – Get Custom Attribute Using SOAP v2

magento-1.9soap-api-v2

Using Magento v1.9.2.3

I'm working on a simple cash register written in C# and using a barcode scanner.
We have already added the barcode as a new attribute to all our products.

I want to get all my products using the SOAPv2 API and save it in a local SQLite. When a barcode is scanned I can look in the database for the price. Seems simple enough.

I already figured out how to get the product data. First I use the catalogProductList to get a list of all my products. Next I use catalogProductList to get more details of a product, including the price.
Using catalogProductAttributeSetList I can get all my attribute sets. Next I can get all the attributes in a set using catalogProductAttributeSetList. Now I know the attribute_id of my barcode attribute. But I can't figure out how to get the value of that attribute in my product.

I did read this Get Custom attribute in API and I truly hope I don't need to mess with Magento and PHP to get this working.

Please let me know if I can read the value of my custom attribute without messing with Magento en PHP.

Best Answer

The answer;

You can add extra attributrs to catalogProductInfo, http://devdocs.magento.com/guides/m1x/api/soap/catalog/catalogProduct/catalog_product.info.html

More information; https://lornajane.net/posts/2010/retrieving-product-attributes-from-magentos-v2-api

Example code for additional_attributes;

var attributes = new catalogProductRequestAttributes {additional_attributes = new[] {"barcode"}};

var productInfo = _magentoService.catalogProductInfo(_magentoLogin, _productId, null, attributes, null)

Related Topic