Product Attachment
v1.1.2
Product Attachment
- Mises à jour et support inclus pendant 12 mois
- Clé de licence livrée immédiatement par email
- Garantie satisfait ou remboursé 30 jours
- Documentation complète incluse
- Installation prête pour Composer
Product Attachments
Associez des documents à vos produits et décidez, fichier par fichier, qui a le droit de les télécharger. Fiches techniques, notices de montage, certificats, conditions de garantie, plans CAO, tarifs — déposez-les directement depuis la fiche produit, réordonnez-les par glisser-déposer, et laissez le storefront les afficher sous le produit.
Chaque fichier est soit public, soit réservé aux clients connectés. C'est ce second mode qui justifie ce module : les fichiers réservés sont stockés hors du web root et ne sont jamais servis que par un controller qui vérifie d'abord le visiteur. Un invité qui devine l'URL, ou à qui on l'envoie, obtient un 404, pas le fichier. Les modules qui déposent leurs uploads dans le dossier media ne peuvent que masquer le lien — le fichier, lui, reste accessible en une URL directe.
À qui ça s'adresse
- Marchands B2B publiant de la documentation technique, des certificats ou des tarifs réservés à leurs clients professionnels
- Fabricants et distributeurs livrant notices, fiches de sécurité ou fichiers CAO avec chaque produit
- Marchands devant garder certains documents derrière un login pour des raisons contractuelles, réglementaires ou commerciales
- Tous ceux qui en ont assez de maintenir leurs PDF produit sous forme de blocs CMS ou de liens en dur dans un template
Bénéfices clés
- Des fichiers réellement restreints — les pièces jointes réservées aux clients vivent hors du web root et sont streamées par un controller qui vérifie le visiteur. Partager l'URL n'apporte rien, ce qui est la seule façon pour « réservé aux clients » d'avoir une valeur.
- Visibilité par fichier — documents publics et restreints cohabitent sur le même produit. Publiez la fiche technique, réservez le tarif.
- Piloté depuis la fiche produit — une section Attachments repliable sur tous les types de produits. Upload, titre, réordonnancement par glisser-déposer, suppression. Aucun écran d'administration supplémentaire à apprendre.
- Rien ne fuite vers les invités — le block du storefront n'affiche strictement rien quand le visiteur n'a accès à aucune pièce jointe : un invité n'apprend même pas que des documents réservés existent.
- Compatible Full Page Cache — le block lit l'état connecté depuis le HTTP context de Magento, sur lequel le cache varie déjà, et porte le cache tag du produit pour que l'enregistrement du produit le rafraîchisse.
- Indépendant du thème — le module fournit un block et un template mais ne les place pas, ce qui lui permet de s'intégrer dans un layout Luma, un thème Hyvä ou une extension d'onglets comme Swissup Easytabs sans contrarier votre design.
Compatibilité
- Magento 2.4.x / équivalent Mage-OS
- PHP 8.1, 8.2, 8.3, 8.4
- Aucune dépendance à d'autres modules Wimakeit
- Fonctionne avec les frontends Hyvä et Luma
- Compatible avec Varnish Full Page Cache
- Types de fichiers autorisés : PDF, DOC, DOCX, XLS, XLSX, CSV, TXT, ZIP, JPG, JPEG, PNG
Installez ce module via Composer. Assurez-vous que votre auth.json est configuré avec vos identifiants Wimakeit.
$ composer require wimakeit/module-product-attachment:^1.1.2
$ bin/magento setup:upgrade
$ bin/magento setup:di:compile
Installation notes
The standard composer require + setup:upgrade + setup:di:compile flow applies. The points below cover what's specific to this module.
Required dependencies
No Wimakeit dependency — this module stands alone. It requires only Magento's own Catalog, Customer, Backend, MediaStorage, Store and Ui modules, which every installation already has.
No admin configuration
The module ships no configuration section. There is nothing to set under Stores → Configuration after installing it: allowed file types and storage location are fixed by design, and visibility is chosen per file on the product itself.
ACL permissions
The module creates no new ACL resource. Uploading attachments is gated on the existing Catalog → Products permission, so any admin role that can already edit products can manage attachments. No role changes are needed after installation.
Where the files are stored
Attachments are written to var/wimakeit/product_attachments/, deliberately outside the web root. This is what makes the "logged-in customers only" setting real: those files have no URL of their own and are streamed by the module's download controller, which checks the visitor first. Storing them under pub/media would leave them reachable by direct URL and reduce the restriction to hiding a link.
Two consequences for your infrastructure:
- Deployment scripts that wipe
var/will delete uploaded attachments. Excludevar/wimakeit/product_attachments/from any cleanup step. var/is not shared between web nodes. On a multi-node setup, mountvar/wimakeit/product_attachments/on shared persistent storage.
Make sure the directory is writable by the PHP user:
mkdir -p var/wimakeit/product_attachments
chown -R www-data:www-data var/wimakeit
The storefront block
Since 1.1.0, nothing to do: the module places itself in product.info.details, group detailed_info — the stock Magento contract for product tabs, honoured by Luma and Hyvä alike. The block is named wimakeit.product.attachments.
Do not add a <referenceBlock> for it. Up to 1.0.x the module shipped unplaced and this page told you to. Doing it now gives you the Documents tab twice.
To move it elsewhere, remove the shipped one first:
<referenceBlock name="wimakeit.product.attachments" remove="true"/>
Same with Swissup Easytabs: remove the shipped block, then create a tab in Content → Easytabs of type Custom Block using the same class and template. One tab per store view if you need a localised title.
The block renders nothing when the visitor may see no attachment, so tab extensions that drop empty tabs will hide the tab by themselves.
The tab does not show up? Your theme decides how detailed_info is rendered, and one that picks its sections positionally will drop this one silently — the module sorts at 20. Check the theme's product-sections template before suspecting the module.
Allowed file types
pdf, doc, docx, xls, xlsx, csv, txt, zip, jpg, jpeg, png. Executable and script types are refused. Uploading is admin-only; there is no frontend upload.
Store scope
Attachments are not store-scoped: one list per product, shown on every store view. If you need per-language documents, that requires adding a store_id column to the wimakeit_product_attachment table.
- Version
- v1.1.2
- Support
- 12 mois
- Dernière mise à jour
- 23 août 2026
- Magento
- Magento 2.4.4 Magento 2.4.5 Magento 2.4.6 Magento 2.4.7 Mage-OS 2.0 Mage-OS 2.1
- PHP
- PHP 8.1 PHP 8.2 PHP 8.3
- Hyvä
- Non compatible
- Package
-
wimakeit/module-product-attachment
Vérifier la compatibilité
Indiquez votre stack pour vérifier la compatibilité du module.
Changelog
Categories: Security, Feature, Fix, Perf, Admin, Deps.
[1.1.2] - 2026-08-18
Fix
- L'onglet « Documents » et six autres libellés s'affichaient en anglais sur les vitrines néerlandaise et espagnole.
- Une vignette qui échoue est désormais tracée dans les journaux, au lieu de disparaître sans explication.
- Le message d'erreur d'un envoi de fichier ne révèle plus de chemins techniques du serveur.
Doc
- Le guide d'installation décrivait encore une pose manuelle du bloc, ce qui aboutissait à deux onglets « Documents » identiques.
[1.1.1] - 2026-08-18
Fix
- Les vignettes des images jointes s'affichaient comme une image cassée dans la fiche produit en admin.
[1.1.0] - 2026-08-18
Feature
- Documents visible sur la fiche produit. Un onglet dédié liste les documents du produit, chacun avec son titre, sa description et son poids — jusqu'ici rien ne s'affichait côté boutique.
- Aperçu visuel. Les images ont une vraie miniature, les autres formats un badge coloré indiquant le type — en back-office comme en vitrine.
- Compteur de téléchargements, avec la date du dernier, visible dans la fiche produit en back-office.
- Visibilité « masqué », pour retirer un document de la vitrine sans le supprimer.
- Description par document, affichée sous son titre.
Fix
- Les documents enregistrés n'apparaissaient plus dans le formulaire produit après rechargement, et étaient perdus à l'enregistrement suivant.
- La table des documents n'était pas créée à l'installation, ce qui rendait l'écran inutilisable.
Security
- Un document masqué reste téléchargeable pour qui connaît son identifiant : corrigé, ainsi que son affichage aux clients connectés.
[1.0.4] - 2026-08-17
Fix
- Packaging. The module no longer ships the development dependencies used to run its own test suite, which could collide with the project's own copies and break code compilation on install.
[1.0.3] - 2026-08-17
Perf
- Unchanged attachments no longer trigger a database write on every product save. Editing a product's price or name issued one pointless UPDATE per attached file; on catalogues with several documents per product this quietly added write load to the most common admin action.
[1.0.2] - 2026-08-17
Security
- Restricted documents could be pointed at arbitrary files on the server. An admin holding only the Catalog > Products permission could make an attachment reference any file under
var/— database backups, logs, customer exports — mark it public, and have it downloaded by anonymous visitors. Attachment paths are now validated and can no longer leave the attachments directory. - Documents of disabled or off-website products stayed downloadable. Attachment ids are sequential, so a document remained reachable by trial and error after its product was taken offline. The download now requires the product to exist, be enabled and belong to the current website.
Fix
- An attachment could be destroyed when replacing its file failed. If storing the new file failed (full disk, permissions), the existing attachment was deleted along with its file instead of being left untouched. A row that cannot be processed is now always preserved.
- Attachment files are removed when a product is deleted. Only the database rows were cleaned up before, leaving the files on disk permanently with nothing left to identify them.
- A failed attachment write no longer interrupts the rest of the save. An error on one row aborted the whole synchronisation and left the product's attachments half-updated.
Perf
- The storefront attachment list is cached again. The block was re-querying the database on every render instead of using its cache entry.
[1.0.1] - 2026-06-08
Fix
- File uploads made reliable across admin form layouts. The uploader failed to pick up the file when the product form posted it under its nested field name, so an upload could silently produce no attachment.
[1.0.0] - 2026-06-08
Feature
- Attach files to any product from the admin product form — PDF, Office documents, images and archives, on every product type, reorderable by drag-and-drop.
- Per-file visibility: public or logged-in customers only. Restricted files are stored outside the web root and served only after the visitor is checked, so sharing the URL gains nothing.
- Storefront listing that reveals nothing to guests — the block renders nothing at all when the visitor may see no attachment, so the existence of restricted documents is never disclosed.
- Full Page Cache compatible — the list varies on the logged-in state Magento already caches on, and refreshes when the product is saved.
- Available in English, French, Dutch and Spanish.
Vous avez trouvé un bug ? Faites-nous-en part.
Un court formulaire s'ouvre dans un nouvel onglet — le nom du module et votre langue sont déjà pré-remplis. Décrivez ce que vous avez tenté, ce qui n'a pas fonctionné, et nous vous répondrons sous un jour ouvré.
Signaler un bug pour Product AttachmentBesoin d'aide ?
Notre équipe est disponible pour vous accompagner dans l'intégration.