get latest products using magento soap API
Asked Answered
C

1

8

i'm trying to get the latest products (max 20) from magento API using SOAP, i only need the images and the product link, as they are being displayed on another site.

i'm using the below code to do that:

$client = new SoapClient('http://magentohost/api/soap/?wsdl');

$session = $client->login('username', 'password');

$apicalls = array();
$i = 0;
$ii = 0;

$filters = array('sku' => array('neq'=>''));

$products = $client->call($session, 'catalog_product.list',array($filters));

foreach ($products as $product){
    $apicalls[$i] = array('catalog_product_attribute_media.list', $product['product_id']);
    $i++;
    $apicalls[$i] = array('catalog_product.info', $product['product_id']);
    $i++;
}

$productinfo = $client->multiCall($session, $apicalls);

however the above code is not displaying the images, any ideas??

Thanks for the help

Commissioner answered 23/3, 2012 at 18:46 Comment(4)
What do you mean by "displaying" exactly? What results are you getting?Deoxygenate
displaying as in get an array of images with the respective product link. for a sample output please go here pastebin.com/MetxheuPCommissioner
Your SOAP Fault is "access denied". Doesn't look like you're using the right credentials. Are you sure you made an API user and not a normal user? Did you make a roll that has priv to do these things?Matty
there is a SO site exclusive for magento developers magento.stackexchange.comScratches
P
2

this code works, My bet is you don't have Product Images selected in Role settings. Please check it and let me know.

Web Service -> SOAP/XML-RPC - Roles -> Role Resources

From tree navigate and check:

Catalog -> Product -> Product Images

Premonitory answered 25/6, 2013 at 13:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.