The popular ERP Plentymarkes let’s you send your orders via the Fulfillment by Amazon program to your customers. Amazon is just used as a logistics partner, the order doesn’t have to come via Amazon. It could e.g. be a Rakuten or eBay order. The problem that Plentymarkets didn’t address at all and is discussed in the private forums, is that Amazon chooses whatever shipping company they seem fit.
Every order has a standard shipping provider and with it comes a URL for tracking the package. Most of the vendors would implement an event procedure („Ereignisaktion“) that sends an email to the customer containing the order and the TrackingID as soon as it’s shipped. The TrackingIDs are directly imported from Amazon. Unfortunately Plentymarkets does not change the shipping provider in case it’s not the default one (which is often the case). So the customer gets wrong information.
In one of last last blogposts I introduced a PHP package to check which shipping provider a TrackingID belongs to by either scraping their website or using a regular expression and filtering for common patterns. In this blog post I want to explain how to use it to fix those orders. You will need a webserver with PHP and MySQL and a little knowledge of programming and Linux.
You can find some simplified code examples on GitHub soon.
- Take your FBA orders out of the event procedures that sends the email to the customers, filter e.g. via WarehouseID
- Instead, use an event procedure to mark those orders with a flag, e.g. a star (ID 2)
- Create a DynamicExport of the type OrderComplete. Filter for your Sent Status (usually 7) and WarehouseID of FBA orders. Include these fields:
- OrderID
- OrderPackageNo
- OrderParcelServiceID
- OrderParcelServicePresetID
- OrderLastUpdateTimestamp
- Implement the SOAP Call GetDynamicExport (will be replaced by REST via Plugin mid-2017)
- Write a Cronjob that calls the GetDynamicExport script with the FormatID of the DynamicExport from #2
- Create a database table called ‚pm_shipping_providers_check‚ with the fields from #2
- Write a script that imports the CSV you downloaded with the GetDynamicExport call into your MySQL database
- Create another DynamicExport, this time of the type Order. Include these fields:
- OrderID (Synchronisation)
- ParcelServiceID (Import)
- ParcelServicePresetID (Import)
- PackageNo (Import)
- Create a table with these fields called ‚pm_shipping_providers_correction‚
- Create a script, that uses the shipping-service-provider-check library to check the every PackageNo in ‚pm_shipping_providers_check‘ and – if the provider is different from the default one – writes it into ‚pm_shipping_providers_correction‘
- Implement the SOAP Call SetDynamicImport (see #3)
- Write a script that exports the table ‚pm_shipping_providers_correction‘ into a (semicolon seperated) CSV.
- Create a cronjob that uploads the file regularly
- Create an event procedure on the event PackageNo that sends out emails, but only for the previously flagged orders