Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Undefined offset: 0 on fetching a Request List #146

Open
nnsdev opened this issue Dec 14, 2017 · 3 comments
Open

Undefined offset: 0 on fetching a Request List #146

nnsdev opened this issue Dec 14, 2017 · 3 comments

Comments

@nnsdev
Copy link

nnsdev commented Dec 14, 2017

Hey, I am currently trying to pull the orders ordered by last updated from the MWS api, I've used your SDK for some other calls and it worked fine there.

My problem is on report type _GET_FLAT_FILE_ALL_ORDERS_DATA_BY_ORDER_DATE_ my call works without problems, but as soon as I switch to _GET_FLAT_FILE_ALL_ORDERS_DATA_BY_LAST_UPDATE_ I am getting an error with Undefined offset: 0 while getting the Report ID.

As I found out, the whole fetched request list is empty.

$list = new AmazonReportRequestList('x');
$list->setReportTypes("_GET_FLAT_FILE_ALL_ORDERS_DATA_BY_LAST_UPDATE_");
$list->fetchRequestList();
$bericht = new AmazonReport('x');
$bericht->setReportId($list->getReportId());

Is there anything I can do to fix this problem?

Note: This is using the laravel wrapper by Sonnenglas, although it uses pretty much all your code.

@Peardian
Copy link
Collaborator

The undefined offset error is happening because I didn't write the list-based get functions very well. It assumes that any given numeric value will be a valid array key and doesn't check to see if the key exists.

As for the problem of why the list is empty, that could just be what Amazon is giving you. Assuming the fork you are using is moderately up-to-date, you can use the getLastResponse() method to see the full raw XML data that Amazon sent.

@nnsdev
Copy link
Author

nnsdev commented Dec 14, 2017

Hey, thanks for the help. I backtracked this and it appears Amazon doesn't give us any data at all which might be the reason why this error pops up, although this report type just sorts the orders after the last update, while the other sorting method for orders sorts after created, which gives a lot of data. Really strange, but I can't really expect much from an 8 year old API.

If I find out why I'll let you know :)

@nnsdev
Copy link
Author

nnsdev commented Dec 23, 2017

Hey, small followup on this.

So as I found out, _GET_FLAT_FILE_ALL_ORDERS_DATA_BY_LAST_UPDATE_ only works if you get it enabled through the MWS support, after we got it enabled the error (obviously) disappeared and everything is working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants