slince / shopify-api-php

:rocket: Shopify API Client for PHP
MIT License
128 stars 48 forks source link

Order data problem with OrderManager and Pagination #103

Open MicahKV opened 3 years ago

MicahKV commented 3 years ago

Hello, thank you for providing this integration! I have encountered an unusual situation where order data is not being returned for a particular shop. I am using this to fetch paginated orders:

$pagination = $client->getOrderManager()->paginate($params);
$orders = $pagination->current($pageCode);

This works for most shops, but I have one shop for which $orders is coming back as an empty array. In trying to identify the problem, I added an ECHO to the createRequest() function in Client.php on line 342 just before it returns the response:

echo((string)$body);

This produces the expected output for most shops:

{"count":53}{"orders":[{"id":...}]}

But this is the output for the problem shop:

{"count":47}{"orders":[]}{"orders":[{"id":...}]}

In this case, there are 2 orders[] arrays shown, the first being empty and the second being populated. This only seems to be an issue with pagination, using the order manager without pagination is successfully returning the order data from the problem shop:

$orders = $client->getOrderManager()->findAll($params); // This is working

Any idea what could cause this problem when using pagination? Is there anything I can do to resolve it?

slince commented 3 years ago

Hello, can you provide your shop domain and a valid access token? Please email me: taosikai@yeah.net

MicahKV commented 3 years ago

Unfortunately I cannot, it was a client's shop and they uninstalled my app shortly after I posted this. I will follow up if I encounter the issue again.