m openmage

OpenMage LTS Developer Documentation

Catalog Inventory

Edit this page on GitHub

Module: Mage_CatalogInventory

The Mage_CatalogInventory module allows you to retrieve and update stock attributes, such as status and quantity.

Inventory

Allows you to retrieve and update the stock data.

Resource Name: cataloginventory_stock_item

Aliases:

Methods:

Faults

Fault Code Fault Message
101 Product not exists.
102 Product inventory not updated. Details in error message.

Examples

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.

Example 1. Working with stock update
$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'));
Example 2. Listing multiple SKUs' data
$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'
            )
        )
    )
);
Create the Magento file system owner