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

Create one or multiply Order line(OrderQuantity) php soap

0

I can make an order whit the right debitor name by Debtor_FindByNumber, it works very well. But in the same script i would like to set one or more orderlines by Product_FindByNumber.

I'm not aple to set the orderlines: 

what am i doing wrong?

My script:

<?php
require_once ("config.php");
$debtor_number = $_GET[firma_id];
      try {
      $debtorHandle = $client->Debtor_FindByNumber(array('number' => $debtor_number))->Debtor_FindByNumberResult;
      $orderHandle = $client->Order_Create(array('debtorHandle' => $debtorHandle))->Order_CreateResult;
  $product = $client->Product_FindByNumber(array('Id' => '130', 'Number' => '1'))->Product_FindByNumberResult;
    $client->OrderLine_SetQuantity(array( 
         'ID' => $product,
         'Quantity' => '2'))-> OrderLine_SetQuantityResult;
     echo 'Oprettet ok';
     } catch (SoapFault $e) {
    echo 'Caught exception: ',  $e->getMessage(), "\n";
    print_r($e);
}
?>

 

created Aug 9, 2015 by suulut
50% Accept Rate

edited Aug 9, 2015 by suulut
Q 8 A 5 C 2

1 Answer

+1
 
Best answer
Hi Suulut

You need to create the order line first.

Instead of using SetQuantity it would be much more efficient to set all data when creating the line: OrderLine_CreateFromData.

Even better; use OrderLine_CreateFromDataArray to add multiple lines and even multiple lines for multiple orders.
answered Aug 10, 2015 by olej
selected Aug 15, 2015 by suulut
Visma e-conomic A/S
...