API Forum

This forum is in read-only mode.
Please refer to our API support in case you have any questions.
We can be reached at api@e-conomic.com
e-conomic API developer forum

Product_UpdateFromDataArray throws error

0
Hi

I am haveing the following code :

Iterate to get array

$productupdateset[]=array('Number'=>$data[3],'Name'=>$data[7],'Description'=>$data[12],'SalesPrice'=>str_replace(',', '.', $data[4])*5,'CostPrice'=>str_replace(',', '.', $data[4]),'RecommendedPrice'=>str_replace(',', '.', $data[4])*4,'IsAccessible'=>1,'Volume'=>0,'ProductGroupHandle'=>array('Number'=>$productgroup_id));

Out of the loop update products :

$create_product=$client->Product_UpdateFromDataArray(array('dataArray'=>array('ProductData'=>$productupdateset)))->Product_UpdateFromDataArrayResult;

But it keeps throwing this error :

Economic.Api.Exceptions.ServerException(E00000): An internal error has occurred. (id=ca9574bd-1b29-4585-a6ce-e361d80b9b50)

Doing the same for Product_CreateFromDataArray dosen't complain. Any hints to what I am doing wrong ?
created Sep 10, 2014 by larsbrandi
0% Accept Rate
Q 3 A 2 C 3

1 Answer

0

Hi, 

Basically what you want is to update the product data. There is one more function in API which I used to accomplish the same. 

Try this :

$args = array(
'Handle' => array('Number'=> '2'),
'Number' => '2',
'ProductGroupHandle' => array('Number'=>'1') ,
'Name' => 'Product 1',
'Description' => 'some description',
'BarCode' => '1232dwe213',
'SalesPrice' => '10.0',
'CostPrice' => '8.00',
'RecommendedPrice' => '10.00',
'UnitHandle' => array('Number'=>1),
'IsAccessible' => true,
'Volume' => '1.0',
'DepartmentHandle' => array('Number'=>1),
'DistributionKeyHandle' => array('Number'=>1),
'InStock' => '10.0',
'OnOrder' => '10.0',
'Ordered' => '10.0',
'Available' => '10.0',
'LastUpdated'=> 'date'
);

$result = $client->Product_UpdateFromData(array('data'=>$args))->Product_UpdateFromDataResult->Number;

answered Sep 12, 2014 by Wisdmlabs
Product_UpdateFromData is what I ended up with. But it is slow.
Visma e-conomic A/S
...