as the title says, I am having no luck adding item(s) to a Sales Order when using the NetSuite PHP API Client created by Ryan Winchester (https://github.com/netsuitephp/netsuite-php). It's really just the Netsuite PHPToolKit with namespaces and autoloading, so it works the same. When I get to the items for the SO, I loop thru them as such:
$items = array();
foreach ($order->basketDetails->basketItems as $item) {
$cartItem = new SalesOrderItem();
$cartItem->item = $itemResponse->searchResult->recordList->record[0]->internalId;
$cartItem->quantity = $item->productQuantity;
$cartItem->rate = "42.97";
$items[] = $cartItem;
Once I have all the items in the array, I add them to a SalesOrderItemList:
$itemList = new SalesOrderItemList();
$itemList->item = $items;
Then I add the item list to the Sales Order ($sale is created earlier in the script with: $sale = new SalesOrder();)
$sale->itemList->item = $itemList;
However, when I try to execute the creation of the Sales Order, I get this error:
[04-Apr-2023 15:11:52 UTC] PHP Fatal error: Uncaught SoapFault exception: [soapenv:Server.userException] org.xml.sax.SAXException: item on {urn:sales_2021_1.transactions.webservices.netsuite.com}SalesOrderItemList must be of type {urn:sales_2021_1.transactions.webservices.netsuite.com}SalesOrderItem in /var/www/composer/vendor/ryanwinchester/netsuite-php/src/NetSuiteClient.php:196
I'm not sure where to go from here as each item is its own SalesOrderItem object. Any help would be greatly appreciated.