Order Dispatch — Order export to a logistics provider / 3PL
Automatically export your orders to your fulfilment provider and re-import tracking numbers.
Requirements and compatibility
Order Dispatch runs on PrestaShop 8.0 to 9.x, on PHP 7.2 minimum (tested up to PHP 8.3), in both single-store and multistore setups.
- The PHP
ftpextension is required for FTP transports and for pulling tracking files over FTP. - The PHP
ssh2extension is required only if you use SFTP mode. Without it, use plain FTP or the HTTP API. - The
curlextension is required for the HTTP API transport and for fetching a tracking URL. - Access to your server crontab (or an external cron service) is recommended to automate exports.
Installation
- In the back office, open Modules > Module Manager.
- Click Upload a module and drop the
dforderdispatch-1.0.0.ziparchive. - Once installation completes, click Configure.
On install, the module creates its log table, registers the actionOrderStatusPostUpdate hook and generates a unique security token for the cron URLs.
Uninstalling deletes the log table and all module configuration keys. Orders and tracking numbers already saved are not affected.
Choosing the export format
The right format depends on what your logistics provider or WMS can read. Three formats are available in the Export format field.
CSV
One row per order line, with the order header repeated on every row. This is the most common layout among fulfilment providers. The delimiter can be a semicolon or a comma.
Generated columns, in order:
order_id ; reference ; date ; payment ; currency ; total_paid ;
shipping_cost ; carrier ; email ; firstname ; lastname ; company ;
phone ; address1 ; address2 ; postcode ; city ; country_iso ;
delivery_note ; sku ; ean13 ; product_name ; quantity ;
unit_price ; line_weight
EDI flat file
Pipe-separated record format with CRLF line endings. Each order produces one H header record followed by one L record per order line.
H|reference|date|carrier|lastname|firstname|address1|address2|postcode|city|country|phone|email|weight
L|reference|sku|ean13|quantity|name
Concrete example:
H|XKBKNABJK|2026-07-05 10:00:00|Colissimo|Dupont|Jean|1 rue de la Paix||06000|Nice|FR|0600000000|[email protected]|1.2
L|XKBKNABJK|SKU-114|1234567890123|2|Premium leather sneakers
Any pipe character found in the data (product name, address) is automatically replaced with a space so the file structure stays intact. Line breaks inside fields are neutralised too.
JSON API
Structured payload, suited to providers exposing a modern API. The whole batch is sent as a single object containing the generation date and an array of orders, each with its header, customer, delivery address and lines.
Choosing the transport
The Transport field determines how the generated file reaches your provider.
Download
No automatic sending. The Export now button generates the file and streams it straight to your browser. Useful to test a format, or for a provider who collects files manually.
FTP
Fill in the host, port (21 by default), username, password and the remote orders directory. Passive mode is enabled by default and suits most hosting environments.
The password field is displayed empty for security reasons. Leave it empty when saving to keep the password already in place.
SFTP
Enable the Use SFTP option and set the SSH port (usually 22) in the port field. The FTP credentials are reused for SFTP. This option requires the PHP ssh2 extension on the server.
HTTP API
The full batch is POSTed to your provider’s URL, the request body containing the generated file directly. Two headers accompany the request:
X-DFOD-KEY: the API key you entered in the configuration.X-DFOD-FILENAME: the filename computed from your pattern.
The content type matches the chosen format (JSON, CSV or plain text). Any HTTP response outside the 2xx range is treated as a failure and logged as such.
Order selection and scheduling
Source order states
In Order states to export, select one or more states (typically Payment accepted and Processing in progress). Only orders in one of these states that have never been exported successfully are picked up.
State change after export
The State after export field automatically moves exported orders to a dedicated tracking state. Leave it on “No change” if you prefer to keep the original state.
Batch limit
The Max orders per batch field caps the size of an export. On high-volume shops, a value between 100 and 300 avoids oversized files and excessive execution times.
Export cron
The cron URL, protected by a unique token, is displayed at the top of the configuration page. Add it to your crontab:
*/15 * * * * curl -s "https://your-shop.com/module/dforderdispatch/cron?token=YOUR_TOKEN" > /dev/null
The cron returns a JSON object with the generated batch, the number of exported orders, the filename and the transport message, which makes it easy to monitor from a supervision tool.
Auto-push mode
Enable Auto push on state change to send each order individually as soon as it enters an exportable state, without waiting for the next cron run. This mode relies on the FTP, SFTP or API transports. It has no effect with the Download transport.
Both modes can coexist: auto-push handles orders as they come in, and the cron catches up on any that failed, with deduplication preventing double sends.
Generated filenames
The Filename pattern field accepts two variables:
{date}: timestamp in YYYYMMDD-HHMMSS format.{batch}: unique batch identifier, also shown in the log.
The extension is added automatically per format: .csv, .txt for EDI and .json. Non-alphanumeric characters are stripped from the final name.
Tracking number re-import
Three channels are available and can be used simultaneously. In all cases the received number is written to the order carrier and to the order’s shipping number field, then the state configured in State after tracking import is applied (usually Shipped).
Channel 1: manual CSV upload
From the Tracking import panel on the configuration page, select a CSV file and run the import. The mapping is configured in the settings:
- Delimiter: semicolon or comma.
- Reference column index: 0 is the first column.
- Tracking column index: same principle.
- Header row: enable if the first line contains column names.
Expected file with the default mapping:
reference;tracking
XKBKNABJK;8R001234567FR
1024;6A987654321FR
The reference column accepts either the PrestaShop order reference or the numeric order ID.
Channel 2: automatic pull (cron)
Two sources can be configured and are processed one after the other on each run:
- Tracking FTP directory: the module lists .csv and .txt files in the folder, imports them, and can delete them afterwards if the matching option is enabled. The FTP credentials are the ones from the transport section.
- Pull URL: an HTTP or HTTPS address returning a tracking CSV directly.
Add the pull URL to your crontab, for example hourly:
0 * * * * curl -s "https://your-shop.com/module/dforderdispatch/tracking?token=YOUR_TOKEN&mode=pull" > /dev/null
Channel 3: webhook pushed by the provider
Give your provider the push URL displayed in the configuration. All they need to do is send a POST request with a JSON body:
POST /module/dforderdispatch/tracking?token=YOUR_TOKEN&mode=push
Content-Type: application/json
[
{"reference": "XKBKNABJK", "tracking": "8R001234567FR"},
{"reference": "1024", "tracking": "6A987654321FR"}
]
A wrapping object of the form {"items": [ ... ]} is also accepted. The response is a JSON report detailing how many orders were updated, skipped and errored, with line-by-line detail.
Log and monitoring
The bottom of the configuration page shows the last fifty operations, both exports and imports, each with its date, the order concerned, the batch identifier, the direction, the format, the transport, the status and the returned message.
Deduplication relies on this log: an order with an export entry in “sent” status will never be picked up in a later batch. To force a re-export, delete the matching row in the module log table.
Troubleshooting
The export returns no orders
Check that states are actually selected in the settings and that orders exist in them. Then check that those orders were not already exported successfully in a previous batch.
The cron returns a token error
The token shown in the configuration must be copied into the URL exactly as-is, with no added spaces or characters. Copy it straight from the configuration page.
The FTP transfer fails
Check the host, port and credentials, then verify the remote directory exists and is writable. If your host blocks outbound connections, passive mode or a firewall exception may be needed.
SFTP is unavailable
A message stating the ssh2 extension is not available means it is not installed on the server. Ask your host to enable it, or switch to plain FTP or the HTTP API.
A tracking number is rejected
Tracking numbers are validated against PrestaShop rules. A number containing disallowed characters is rejected and logged as an error, without blocking the rest of the import.
Frequently asked questions
Can I export to several providers?
The module handles one outbound flow configured at a time. To feed two distinct providers, the simplest approach is to separate orders by different states and handle each flow separately.
Are multistore orders supported?
Yes, the module works in a multistore context. Configuration settings follow the PrestaShop context in which they were saved.
What happens if the provider is unreachable?
The failure is logged with its error message and the affected orders are not marked as sent. They will therefore be picked up automatically on the next cron run, with no action needed from you.
Does the state change trigger customer emails?
Yes. The module uses the standard PrestaShop state change mechanism. Notifications tied to the target state, notably the shipping email containing the tracking number, are sent normally.