Search code examples
phpmagentomagento-soap-api

Magento Soap V2 catalogProductListOfAdditionalAttributes not being recognized.


I am reading magnetos documentation and in there they have a section that shows how to retrieve a products additional attributes.

http://www.magentocommerce.com/api/soap/catalog/catalogProduct/catalog_product.listOfAdditionalAttributes.html

One of the examples they show is the following for Soap V2...

$proxy = new SoapClient('http://magentohost/api/v2_soap/?wsdl'); // TODO : change url
$sessionId = $proxy->login('apiUser', 'apiKey'); // TODO : change login and pwd if necessary

$result = $proxy->catalogProductListOfAdditionalAttributes($sessionId, 'simple', '13');
var_dump($result);

Well I tried that example and I get a soap error. that says the following

Fatal error: Uncaught SoapFault exception: [Client] Function ("catalogProductListOfAdditionalAttributes") is not a valid method for this service

I looked up the method in wsdl xml page and I couldn't find anything that remotely matched it. So is the documentation out dated ?? Is my wsdl out date or whats going on here ? I am using v2


Solution

  • Figured it out...

    $attributeList = $fclient->catalogProductAttributeList($fsession, $prod->set);
    

    The above give you additional and core attributes. Where $prod->set is the products attribute set number.

    And even better. if you want to get ALL of a certain products attributes values, you can do the following

            foreach($attributeList as $attr) {
                $attributes->additional_attributes[] = $attr->code;
            }
            $prodInfo = $fclient->catalogProductInfo($fsession, $prod->product_id, null,$attributes);
    

    The above will return back all of a products attribute's values both core and custom within additional attributes.