1

I am trying to update the Stock data,Using SOAP V1, but many values are not updating.

$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
$stockItemData = array(
    'qty' => $qty,
    'is_in_stock' => $product->getIsInStock(),
    'manage_stock' => $stock->getManageStock(),
    'use_config_manage_stock' => $stock->getUseConfigManageStock(),
    'min_qty' => $stock->getMinQty(),//not updated
    'use_config_min_qty' => $stock->getUseConfigMinQty(),//not updated
    'min_sale_qty' => $stock->getMinSaleQty(),//not updated
    'use_config_min_sale_qty' => $stock->getUseConfigMinSaleQty(),//not updated
    'max_sale_qty' => $stock->getMaxSaleQty(),//not updated
    'use_config_max_sale_qty' => $stock->getUseConfigMaxSaleQty(),//not updated
    'is_qty_decimal' => $stock->getIsQtyDecimal(),//not updated
    'backorders' => $stock->getBackorders(),//not updated
    'use_config_backorders' => $stock->getUseConfigBackorders(),//not updated
    'notify_stock_qty' => $stock->getNotifyStockQty(),//not updated
    'use_config_notify_stock_qty' => $stock->getUseConfigNotifyStockQty(),//not updated
    'stock_status_changed_auto' => $stock->getStockStatusChangedAuto(),//not updated
    'use_config_qty_increments' => $stock->getUseConfigQtyIncrements(),//not updated
    'qty_increments' => $stock->getQtyIncrements(),//not updated
    'use_config_enable_qty_inc' => $stock->getUseConfigEnableQtyInc(),
    'enable_qty_increments' => $stock->getEnableQtyIncrements(),//not updated
    'is_decimal_divided' => $stock->getIsDecimalDivided(),//not updated
    'type_id' => $stock->getTypeId(),
    'stock_status_changed_automatically' => $stock->getStockStatusChangedAutomatically(),//not updated
    'use_config_enable_qty_increments' => $stock->getUseConfigEnableQtyIncrements()
);
$proxy->call($sessionId, 'product_stock.update', array($product->getId(), $stockItemData));

I have checked, all the passed values, and its correct,and even tried to pass static value to test, but not worked. Please help.

0

I solved this by running this way

$soapMulticalls = array();
$stock = Mage::getModel('cataloginventory/stock_item')->loadByProduct($product);
$arrProductsExists = $proxy->call($sessionId, 'catalog_product.list');
$soapMulticallDataItem = array(
    'catalog_product.update',
    array(
        $product->getSku(),
        array(
            'stock_data' => array(
            'qty' => $qty,
            'is_in_stock' => $product->getIsInStock(),
            'manage_stock' => $stock->getManageStock(),
            'use_config_manage_stock' => $stock->getUseConfigManageStock(),
            'min_qty' => $stock->getMinQty(),
            'use_config_min_qty' => $stock->getUseConfigMinQty(),
            'min_sale_qty' => $stock->getMinSaleQty(),
            'use_config_min_sale_qty' => $stock->getUseConfigMinSaleQty(),
            'max_sale_qty' => $stock->getMaxSaleQty(),
            'use_config_max_sale_qty' => $stock->getUseConfigMaxSaleQty(),
            'is_qty_decimal' => $stock->getIsQtyDecimal(),
            'backorders' => $stock->getBackorders(),
            'use_config_backorders' => $stock->getUseConfigBackorders(),
            'notify_stock_qty' => $stock->getNotifyStockQty(),
            'use_config_notify_stock_qty' => $stock->getUseConfigNotifyStockQty(),
            'stock_status_changed_auto' => $stock->getStockStatusChangedAuto(),
            'use_config_qty_increments' => $stock->getUseConfigQtyIncrements(),
            'qty_increments' => $stock->getQtyIncrements(),
            'use_config_enable_qty_inc' => $stock->getUseConfigEnableQtyInc(),
            'enable_qty_increments' => $stock->getEnableQtyIncrements(),
            'is_decimal_divided' => $stock->getIsDecimalDivided(),
            'type_id' => $stock->getTypeId(),
            'stock_status_changed_automatically' => $stock->getStockStatusChangedAutomatically(),
            'use_config_enable_qty_increments' => $stock->getUseConfigEnableQtyIncrements()
            )
        )
    )
);
array_push($soapMulticalls, $soapMulticallDataItem);
if (count($soapMulticalls) > 0) {
    $proxy->multiCall($sessionId, $soapMulticalls);
}

And its working fine ;)

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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