Magento SOAP API
Magento SOAP API – Magento is best e-commerce tool no doubt and SOAP integration in magento is “Cherry in the cake” .Magento provides a very simple SOAP API integration .
1 – Go to Magento Admin -> web services ->role and add a simple rule over there lets say “WebKul”
2 – Go to Magento Admin -> web services ->user and add a user with the detailed info most important fact is to set the permission of user to all instead of custom
3 – Create a Php file outside the magento and add the sample code.
$devClient = new Soapclient('http://192.168.1.61/magento/index.php/api/?wsdl');
$devSession = $devClient->login('apiuser', 'apipassword');
$productList = $devClient->call($devSession, 'catalog_product.list');
foreach ($productList as $product){
$theProduct = array();
$theProduct['product'] = $product;
$theProduct['attributeSet'] = current($devClient->call($devSession, 'product_attribute_set.list'));
$theProduct['info'] = $devClient->call($devSession, 'catalog_product.info', $product['sku']);
$theProduct['related'] = $devClient->call($devSession, 'catalog_product_link.list', array('related', $product['sku']));
$theProduct['up_sell'] = $devClient->call($devSession, 'catalog_product_link.list', array('up_sell', $product['sku']));
$theProduct['cross_sell'] = $devClient->call($devSession, 'catalog_product_link.list', array('cross_sell', $product['sku']));
$theProduct['grouped'] = $devClient->call($devSession, 'catalog_product_link.list', array('grouped', $product['sku']));
$theProduct['images'] = $devClient->call($devSession, 'catalog_product_attribute_media.list', $product['sku']);
$theProduct['tierprice'] = $devClient->call($devSession, 'product_tier_price.info', $product['sku']);
$theProduct['stock'] = $devClient->call($devSession, 'product_stock.list', $product['sku']);
$allProducts[] = $theProduct;
}
echo '$allProducts:' . print_r($allProducts, true) . '';
Categories:
magento
View Comments
Comment or Ask a Question
Quick Links