Exact Online Picqer Stock request

740 views Asked by At

I'm trying to build an import function for exact online to Magento. I want to read out all products (Items) in exact online and add the right Stock and Sale Price to a loop.

However I cant get it to work because of the different errors i get.

Can you guys push me in the right direction with this one?

<?php
// Authenticate with the server
include 'authenticate.php';

$id = '0df2e928-12f1-4830-93c1-004f983c6d83';
$filter_stock = "itemId eq guid'$id'";
echo $filter_stock;

try {
   $stockPosition = new \Picqer\Financials\Exact\StockPosition($connection);
   $stockPositions = $stockPosition->filter($filter_stock);
   var_dump($stockPositions);
} catch (\Exception $e) {
   echo get_class($e) . ' : ' . $e->getMessage();
}

This gives me itemId eq guid'0df2e928-12f1-4830-93c1-004f983c6d83'Picqer\Financials\Exact\ApiException : Error 400: Bad Request - Error in query syntax.

What is the error in my query syntax? I tried = instead of eq and ItemID ItemId itemid etc...

1

There are 1 answers

0
Lex On BEST ANSWER

There was a known error with StockPisition.php.

I managed to fix this by changing the default filter function to:

$stockPositions = $stockPosition->filter([], '', '', ['itemId' => "guid'{$itemID}'"]);