--- layout: m1x_soap title: Catalog Inventory ---
The Mage_CatalogInventory module allows you to retrieve and update stock attributes, such as status and quantity.
Allows you to retrieve and update the stock data.
Resource Name: cataloginventory_stock_item
Aliases:
Methods:
| Fault Code | Fault Message |
|---|---|
| 101 | Product not exists. |
| 102 | Product inventory not updated. Details in error message. |
Change manage_stock setting to ‘off’ in the inventory area.
$attributeSets = $client->call($session, ‘product_stock.update’, array(’SKU’,array(’manage_stock’=>'0’,’use_config_manage_stock’=>'0’)));
The use_config_manage_stock unchecks the ‘Use Config Settings’ box which allows you to make changes to this product and not to use the global settings that are set by default.
$proxy = new SoapClient('http://magentohost/api/soap/?wsdl');
$sessionId = $proxy->login('apiUser', 'apiKey');
// Get stock info
var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));
// Update stock info
$proxy->call($sessionId, 'product_stock.update', array('Sku', array('qty'=>50, 'is_in_stock'=>1)));
var_dump($proxy->call($sessionId, 'product_stock.list', 'Sku'));
$client = new SoapClient('http://magentohost/api/soap/?wsdl');
$sid = $client->login('apiUser', 'apiKey');
print_r(
$client->call(
$sid,
'product_stock.list',
array(
array( // Notice the nested array
'sku1',
'sku2',
'sku3',
...
'skuN'
)
)
)
);