1. What this module does
The module attaches your own files to the e-mails PrestaShop sends when an order changes status: the invoice your
ERP writes to a folder, a return form, a warranty card, a shipping label or your terms. You choose the statuses and
give the path of the file with order placeholders, such as invoices/{order_reference}.pdf, or upload a file once.
When the file is not there, each rule decides whether the e-mail goes out without it or is held back.
Works with PrestaShop 1.7.8, 8.x and 9.x (PHP 7.2.5 or newer) and with multistore.
2. Installation
- Download the module from My account → Order history at addonspresta.com.
- In your Back Office, open Modules → Module Manager and click Upload a module.
- Drop the
ap_statusattachments_v1.0.0.zipfile and wait for the confirmation. - Click Configure on the module card.
On PrestaShop 1.7 and 8 with shell access, you can also unpack the zip into modules/ and run
php bin/console prestashop:module install ap_statusattachments from the shop folder.
The installation creates the folder var/ap_statusattachments/ in your shop: the default base folder, where the
module looks for files. It also adds a deny file for Apache and an index.php to it. There is no rule yet, so no
e-mail changes until you add one.
3. How it works
The base folder. Every file the module attaches lies in one folder on the server, the base folder, or in its subfolders. Your ERP, your accounting software or you put the documents there; the module only reads them. The paths in the rules are relative to this folder, so a rule can never reach a file outside it.
Which e-mail belongs to which status. When PrestaShop sends an e-mail about an order, the module looks at the order's status history: the newest status that sends an e-mail and whose template, in the language of the order, is the template of this e-mail gives the status. So it works however the status was set: by an employee in the Back Office, by a payment module, through the webservice, or with Resend email on the order page. E-mails that do not belong to a status — the order confirmation, messages, credit slips, account e-mails — are left untouched.
What is attached. The active rules of the order's shop (and the rules for all shops) that include this status are read in the order of the list. For each line of each rule, the module fills in the placeholders with the values of the order and looks for the matching files. The files found are added to the e-mail with their own name. A file found by two rules is attached once. PrestaShop's own invoice and delivery slip, when the status attaches them, stay in the e-mail.
When a file is missing. A line counts as missing when:
- a placeholder has no value for this order, for example
{invoice}before the order has an invoice; - no file matches the path;
- the file has a type that is not in Allowed file types;
- the file does not fit into Maximum size per e-mail or Maximum files per e-mail.
The rule then follows When a file is missing: with Send the e-mail without it, the customer gets the e-mail with the other files; with Do not send the e-mail, the status still changes, but PrestaShop does not send this e-mail at all. Every missing file and every e-mail held back is written to Advanced Parameters → Logs, with the rule name, the path and the order ID.
Errors never stop an e-mail. If something unexpected goes wrong inside the module, the e-mail is sent without the module's files and the error is written to Advanced Parameters → Logs. A status change is never blocked.
Shop settings the module needs. The status must send an e-mail: in Shop Parameters → Order Settings → Statuses, edit the status and tick Send an email to the customer with a template. PrestaShop must send e-mails at all (Advanced Parameters → E-mail, not "Never send emails"). The module adds files to the e-mails PrestaShop sends and sends nothing by itself.
Who can do what. Only a SuperAdmin can choose the base folder. Every employee with the Configure permission on the module can attach any file of the base folder to any status e-mail — also to an order of their own. Keep only documents meant for customers in the base folder: no exports, backups or other private files.
The module stores its rules in two tables of its own and its settings in four configuration keys. It does not change PrestaShop tables and does not connect to addonspresta.com or any other server. The files go only to the customer of the order, inside the e-mail PrestaShop sends.
4. Features and settings
Open Modules → Module Manager → Order Status Attachments → Configure. The Help box at the top links this manual and the module page at addonspresta.com in the language of your Back Office, gives our support address and shows the installed version. Below it are the rules, the Check an order panel and the settings.
Rules
The list shows each rule with its name, its order statuses, its file paths, what happens when a file is missing, its shop (in multistore) and an Active switch: click the icon to turn the rule on or off. Edit opens the rule, Delete removes it after a confirmation; files you uploaded for it stay in the base folder. The + button in the panel header adds a rule.
The rule form has these fields.
Name
A name only for you, up to 128 characters, for example "Invoice from the ERP when shipped". It appears in the list, in Check an order and in the logs.
Active
Off: the rule is kept but attaches nothing.
Order statuses
Tick the statuses whose e-mail gets the files, at least one. A status marked (no e-mail) sends no e-mail to the customer, so a rule on it does nothing until you turn its e-mail on in Shop Parameters → Order Settings → Statuses.
Files
One path per line, from 1 to 20 lines of up to 255 characters, relative to the base folder, with / between
folders: for example invoices/{order_reference}.pdf or returns/form-{lang_iso}.pdf. A path may contain letters,
digits, -, _, ., spaces, /, the wildcards * and ? and the placeholders below. A leading /, .., \,
~, an empty folder name (//) and unknown placeholders are refused.
Placeholders, with an example value:
{id_order}— the order ID, for example125.{order_reference}— the order reference, for exampleXKBKNABJK.{invoice_number}— the invoice number, for example7; empty until the order has an invoice.{invoice}— the invoice name the way PrestaShop builds it: the invoice prefix in the order language followed by the number on 6 digits, for exampleIN000007; empty until the order has an invoice. The prefix is set in Orders → Invoices.{delivery_number}— the delivery slip number, for example3; empty until the order has a delivery slip.{id_customer}— the customer ID, for example42.{id_order_state}— the ID of the status being sent, for example4.{id_shop}— the shop of the order, for example1.{lang_iso}— the language of the order, for exampleen.{yyyy},{mm},{dd}— the year, month and day the order was placed, for example2026,11,21.
Each value keeps only letters, digits, - and _; anything else is removed (a prefix #IN gives IN000007). A
value can therefore never add a folder or a wildcard to the path.
Wildcards: * matches any text and ? exactly one character, within one folder — they never reach into a
subfolder. labels/{order_reference}-*.pdf attaches every label of the order, sorted by name. Only readable files
with an allowed type inside the base folder count.
Take care with wildcards. A line with * or ? and no order placeholder ({id_order}, {order_reference},
{invoice_number}, {invoice}, {delivery_number} or {id_customer}) matches the same files for every order: every
customer gets every matching file. invoices/*.pdf would send all your invoices to each customer. After saving, the
module warns about every such line. Use them only for documents meant for all customers.
Upload a file
Choose a file to send it with every e-mail of the rule, for example your terms or a return form. It is saved in the
base folder under uploads/ in a folder with a random name, and its path is added to Files when you save. Only
pdf, jpg, jpeg, png, gif, webp, txt, csv, doc, docx, xls, xlsx, odt, ods and zip are accepted, and only when the type
is also in Allowed file types; for pdf and images the content must match the extension. The maximum size, shown
under the field, is the smaller of Maximum size per e-mail and the upload limit of your server. If the rule cannot
be saved, the uploaded file is removed again.
When a file is missing
- Send the e-mail without it (default) — the customer gets the e-mail with the other files.
- Do not send the e-mail — the status changes, but PrestaShop does not send this e-mail. Use it when the e-mail makes no sense without the document, for example "Here is your invoice".
Missing also means no value for a placeholder (no invoice yet), a file type that is not allowed or a limit reached. Every case is written to Advanced Parameters → Logs.
Check an order
Enter an Order ID and click Check. For each active rule of the order's shop, the panel shows its statuses,
the files found with their size and the lines that are missing for that order now. Nothing is sent. The placeholder
{id_order_state} is checked with the current status of the order. The limits apply to each rule on its own here,
while an e-mail counts the files of all its rules together.
You need the permission to view orders and access to the order's shop; otherwise the panel answers "Order not found". Rules for all shops are shown only to an employee who manages every shop.
Settings
The settings are the same for every shop. Only an employee who manages every shop can save them.
Base folder
The absolute path of the folder with your documents, for example /home/shop/documents. Leave it empty to use the
default folder var/ap_statusattachments of the shop. The folder must exist, the web server must be able to read
it, and it cannot be the shop folder or a folder above it.
Only a SuperAdmin sees and changes this field. Other employees never see the server path: they read "In use: var/ap_statusattachments." for the default folder, or "In use: the folder set by the SuperAdmin." for another one. Under the field the module shows the state of the folder:
- In use — the folder works.
- does not exist or cannot be read by the web server — no file can be attached until you fix the folder or its permissions.
- contains the shop itself and cannot be used — choose a folder inside or outside the shop, not above it.
Employees who are not SuperAdmin see the same states without the path: "The base folder does not exist: no file can be attached.", "The base folder cannot be read by the web server: no file can be attached." or "The base folder contains the shop itself and cannot be used."
When you choose an empty folder inside the shop, the module adds a deny file for Apache and an index.php to it. A
folder inside the shop that already holds files gets no deny file — it might be a public folder of the shop — and you
see a warning instead: make sure its files cannot be opened over the internet.
A folder inside the shop may be reachable over the internet on nginx, which ignores the deny file, and invoices named after the order reference are easy to guess. Keep generated documents in a folder outside the shop, or ask your host to add a rule like this to the nginx configuration of the shop:
location ^~ /var/ { deny all; }
or the same rule for the folder you chose.
Allowed file types
Extensions separated by commas, from 1 to 40, for example pdf, xml, zip. By default: pdf, jpg, jpeg, png, gif,
webp, txt, csv, xml, zip, doc, docx, xls, xlsx, odt and ods. Script and web page types (php, js, html, svg…) are never
allowed. A file of another type counts as missing.
Maximum size per e-mail
All the module's files in one e-mail together, from 1 to 50 MB; 10 MB by default. A file that would go over the limit is not attached and counts as missing. Many mail servers refuse messages above 20 MB.
Maximum files per e-mail
From 1 to 50; 10 by default. Files beyond it are not attached and count as missing.
Examples
Invoices from your ERP. Your ERP saves each invoice as invoices/2026/IN000007.pdf in the base folder. Rule:
statuses "Shipped", file invoices/{yyyy}/{invoice}.pdf, Do not send the e-mail when it is missing — the
customer never gets a shipping e-mail without the invoice, and the log shows which orders to look at. {yyyy} is the
year of the order, not of the invoice: if your ERP files invoices by invoice year, an order of December invoiced in
January is looked for in the wrong folder, so use one folder for all years (invoices/{invoice}.pdf) or name the files
after the order reference (invoices/{order_reference}.pdf).
A return form in the customer's language. Put form-en.pdf, form-fr.pdf and so on in returns/. Rule:
status "Delivered", file returns/form-{lang_iso}.pdf, Send the e-mail without it — a language without a form
simply gets no form.
Terms for everyone. In a rule for "Payment accepted", upload your terms as a PDF. The line
uploads/<random folder>/terms.pdf is added for you, and every customer gets the same document.
5. Multistore
The settings — base folder, file types and limits — are the same for every shop. Rules belong to a shop: a rule added while one shop is selected in the Back Office header applies to the orders of that shop. A rule added in the All shops context or in a shop group context applies to every shop, and only an employee who manages every shop can add it; other employees select one of their shops first. The list shows the rules of the shops selected in the header together with the rules for all shops, with the shop of each rule. Each employee sees, edits and checks only the rules of the shops they manage. One licence covers every shop of the installation.
6. Uninstall
Module Manager → Order Status Attachments → Uninstall removes all rules and settings. The base folder and every file in it — your documents and the uploaded files — stay on the server; delete them yourself if you no longer need them. To keep the rules, use Disable instead.
7. FAQ and troubleshooting
The file is not attached.
Enter the order in Check an order and read Advanced Parameters → Logs (messages starting with
ap_statusattachments:). Then check, in this order:
- the status sends an e-mail (Send an email to the customer in Shop Parameters → Order Settings → Statuses; the rule form marks the other statuses "(no e-mail)") and PrestaShop sends e-mails at all;
- the rule is active, includes this status and belongs to the order's shop or to all shops;
- the path matches the file name exactly, letter case included, relative to the base folder;
- every placeholder has a value:
{invoice}and{invoice_number}stay empty until the order has an invoice,{delivery_number}until it has a delivery slip; - the type of the file is in Allowed file types;
- the file fits into Maximum size per e-mail and Maximum files per e-mail, together with the files of the other rules;
- the base folder shows In use in the settings.
The customer did not get the e-mail at all. A rule set to Do not send the e-mail missed a file: the log says which e-mail of which order was not sent. The status has changed anyway. Put the file in place, check the order in Check an order, then open the order and use Resend email next to that status in its history.
The customer did not get the e-mail, or got it without the files, although the file is there. The mail server may refuse large messages: many refuse above 20 MB, some above 10 MB. Lower Maximum size per e-mail or send smaller files, for example compressed PDFs.
Where are uploaded files stored? Are they deleted with the rule?
In the base folder, under uploads/, each in a folder with a random name. Deleting a rule or uninstalling the module
keeps them; delete them on the server when you no longer need them.
I use a module that sends e-mails through another service.
Some mail-transport modules send the e-mail themselves in the same hook as this module. In Design → Positions,
find the hook actionEmailSendBefore and move Order Status Attachments above that module. Otherwise the e-mail leaves
before the files are added, and an e-mail meant to be held may still be sent.
Does the customer still get the PrestaShop invoice? Yes. When the status attaches the invoice or the delivery slip, they stay in the e-mail and the module adds its files next to them.
Can I attach a file to the order confirmation e-mail? No. The module works with the e-mails of order statuses. The order confirmation is sent by PrestaShop separately; use the e-mail of the first status of the order instead, for example "Payment accepted".
After saving I see a warning about a wildcard.
The line has * or ? but no order placeholder, so every customer gets every matching file. That is right for a
document meant for everyone; otherwise add {order_reference}, {id_order} or {invoice} to the line.
The settings say the base folder does not exist or cannot be read. No e-mail gets files until it is fixed — e-mails are then sent without the module's files, also for rules set to Do not send the e-mail, and each one is written to the log. Create the folder or give the web server read access to it, or ask a SuperAdmin to choose another folder.
Can customers open the files over the internet? On Apache the default folder is protected by its deny file. On nginx it may be reachable: add a deny rule to the nginx configuration (see Base folder) or keep the documents in a folder outside the shop.
A text is still in English in my Back Office. The texts of the module are translated in International → Translations → Installed modules translations.
8. Updates and support
Updates are free for life: download new versions from My account → Order history at addonspresta.com and upload them like a new module. Your settings, rules and files are kept.
Support is included for 12 months from your order: write to mail@addonspresta.com or use the contact
form at addonspresta.com (Monday to Friday, 10:00–16:00 CET; we usually answer within 2 business days). Please
include your PrestaShop version, the module version, the steps that lead to the problem and the lines of
Advanced Parameters → Logs starting with ap_statusattachments:.