3

This simple query works as expected with SOAP V2:

$result = $proxy->catalogProductList($sessionId);
var_dump($result);

but swap the Role resource access to Catalog Inventory > Retrieve stock data …and substitute this instead:

$result = $proxy->catalogInventoryStockItemList($sessionId, array('1', '2'));
var_dump($result);

…and the result is:

array(0) { }

But there are plenty of products with inventory of at least 1.

Any ideas? Thanks!

Magento 1.9.2.2

http://www.magentocommerce.com/api/soap/catalogInventory/cataloginventory_stock_item.list.html

  • Do you have a product with Id 1 Or Id 2? – SH- Nov 25 '15 at 22:45
  • It return result if product with id 1 and 2 exist in your catalog – Minesh Patel Nov 26 '15 at 5:16
  • Thank SH and Minesh Patel. For now, unable to test any further...as even the first simple query has stopped working! The server hosts deny changing anything. Strange. – johnno Dec 8 '15 at 19:54
2

I had a similar problem. My situation was different in a few respects:

  1. I'm using the V1 API.
  2. I'm passing SKUs instead of product IDs.

Here was my original code:

$skus = ['SKU001', 'SKU002', 'SKU003'];
$results = $client->call(
        $sessionID,
        'cataloginventory_stock_item.list',
        $skus);

Just like the documentation says, right? But I was getting an empty array result, too.

When I stepped through the Magento code using the debugger, I saw that only the first SKU in my list was being passed to the API method, and passed as a string, not an array. So I wrapped my array of SKUs in another array like so:

$results = $client->call(
        $sessionID,
        'cataloginventory_stock_item.list',
        [$skus]);  // Note the square brackets here.

That solved the problem. It seems the API docs on Magento's website are just plain wrong.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.