In magento1.9 - I am trying to update product quantity using soap but it return error here is my code
public function update($data){
//return $data->sku;
$_sku = $data->sku;
$_catalog = Mage::getModel('catalog/product');
$_productId = $_catalog->getIdBySku($_sku);
$product = Mage::getModel('catalog/product')->load($_productId);
/*$product->setStoreId($this->_getStoreId())
->load($productId);*/
//return $product->getData();
if (!$product->getId()) {
$this->_fault('not_exists');
}
if (!$stockData = $product->getStockData()) {
$stockData = array();
}
if (isset( $data->qty)) {
$stockData['qty'] = $data->qty;
}
if (isset($data->is_in_stock)) {
$stockData['is_in_stock'] = $data->is_in_stock;
}
$product->setStockData($stockData);
try {
$product->save();
} catch (Mage_Core_Exception $e) {
$this->_fault('not_updated', $e->getMessage());
}
return $stockData;
}
then i am getting below erros :
==> Error: Uncaught SoapFault exception: [1] Internal Error. Please see log for details. in C:\xampp\htdocs\shubhajay_magentonew\app\code\core\Mage\Api\Model\Server\Adapter\Soap.php:196 Stack trace: #0 C:\xampp\htdocs\shubhajay_magentonew\app\code\core\Mage\Api\Model\Server\Handler\Abstract.php(139): Mage_Api_Model_Server_Adapter_Soap->fault('1', 'Internal Error....') #1 C:\xampp\htdocs\shubhajay_magentonew\app\code\core\Mage\Api\Model\Server\Handler\Abstract.php(48): Mage_Api_Model_Server_Handler_Abstract->_fault('internal') #2 [internal function]: Mage_Api_Model_Server_Handler_Abstract->handlePhpError(256, 'Some transactio...', 'C:\xampp\htdocs...', 4039, Array) #3 C:\xampp\htdocs\shubhajay_magentonew\lib\Varien\Db\Adapter\Pdo\Mysql.php(4039): trigger_error('Some transactio...', 256) #4 [internal function]: Varien_Db_Adapter_Pdo_Mysql->__destruct() #5 {main} thrown