I am getting a list of the products using catalog_product.list. It takes less than a second to get that for about 700 products. Then I am looping through each product using catalog_product.info to get values like the price. But it takes a very long time ~180 sec. Is there a better way to do it?
I am outputting the products as csv, xml, and json with only field "sku", "name", "price" and "short_description". I got sku and name from catalog_product.list. I couldn't find any way of retrieving price and short_description so I looped through the products to get info using catalog_product.info (catalog_product.info for 1 product takes about 2 secs.) Here is the api website https://devdocs.magento.com/guides/m1x/api/soap/catalog/catalogProduct/catalog_product.list.html
$products = $client->call($sessionId, "catalog_product.list");
echo "<pre>";
print_r($products);
$cleanProducts=[];
// foreach($products as $product){
for($i=0; $i<5; $i++){
$product=$products[$i];
$catalogProductReturnEntity = $client->call($sessionId, 'catalog_product.info', $product['product_id'] );
$cleanProduct = [];
$cleanProduct['sku']=$product['sku'];
$cleanProduct['name']=$product['name'];
// $cleanProduct['price'] = $catalogProductReturnEntity['price'];
// $cleanProduct['short_description'] = $catalogProductReturnEntity['short_description'];
$fields = [ 'price', 'short_description'];
foreach($fields as $field){
if(isset($catalogProductReturnEntity[$field])!=null){
$cleanProduct[$field] = $catalogProductReturnEntity[$field];
}
}
$cleanProducts[] = $cleanProduct;
}
echo "<pre>";
print_r($cleanProducts);
It doesn't make sense for API to take this long. Have anyone found the quickest way to do this? I haven't use Module: Mage_Catalog as this is just an assessment test. And I am limited to use Magento-1.9 and SOAPv1. Let me know if there are any return contents that give more information in a list.
The first array is from Info from catalog_product.list The second array is from Info from catalog_product.info The third array is generated from the code.
My Question is: Is there a shortcut on Magento SOAP to get 3rd array without going through 1st and 2nd step?