fillup / walmart-partner-api-sdk-php

PHP client for Walmart Partner APIs
MIT License
37 stars 51 forks source link

Using sequential arrays of products #19

Closed cralls closed 8 years ago

cralls commented 8 years ago

For users sending sequential arrays of products to the bulk() function I had to inject the MPItemFeedHeader into the XML before instantiating PostFile in Item.php. I added a $time variable to make each request unique as well.

`$time = microtime(); $xml = str_replace('<?xml version="1.0" encoding="UTF-8"?>', '<?xml version="1.0" encoding="UTF-8"?>

2.1 '.$time.' '.$time.' ', $xml); $xml = $xml . ''; `
fillup commented 8 years ago

@cralls I'm not sure I understand what you are doing or why, can you explain further? Is there an issue with the library or did you just determine you need unique values for requestId and requestBatchId? Why are you adding them via str_replace into the XML instead of just passing the values to the bulk() method as intended?

Take a look at the example at https://github.com/fillup/walmart-partner-api-sdk-php/blob/develop/docs/item.md#bulk-createupdate-items

It is just a function call with your data, so if you need to send multiple calls to bulk you should just pass different values in the array to the function. Unless I am not understanding your issue in which case please reopen this issue and explain it further.