Logic for Listing cron
Sending feed:
- Collect all items for listing + items for which iat.deactivate_item = 1
- Send them to Tesco
- these for listing → with operation 'Create', **set revise_item = 'sent'; set mfo.end_item = 0**
- these with iat.deactivate_item = 1 → with operation 'Suspend', set mfo.end_item = 1
For errors during checks for the items (before adding them to the feed) :
a.Save them in revise_item_error if iat.deactivate_item = 0 + set revise_item = error
b.Save them in ending_error if iat.deactivate_item = 1 + set iat.deactivate_item = 0
Reading the response:
Errors:
- If mfo.end_item = 1
- Save the error in ending_error
- set iat.deactivate_item = 0
- If mfo.end_item = 0
- save the error in revise_item_error
- set revise_item =' error'
Successes:
- If mfo.end_item = 1
- set listingStatus = 'inactive'
- set iat.deactivate_item = 0
- If mfo.end_item = 0
- set revise_item = 'normal'
- set update_quantity = 'pending'
- set listingStatus = 'active'
- set productStatus = 'published'
- save SKU as ChannelItemID for each item