Skip to content
Catalog & Product Extensions

Product Attachments for Magento 2

Attach PDFs, manuals, datasheets and links to Magento 2 products, categories and CMS pages from one admin list. Limit downloads by customer group, login or past purchase, and see every download in an admin log. Free, for Hyvä and Luma.

  • Free
  • Themes listed: Hyvä + Luma
Free $0.00, in stock
Check requirementsSee the versions and themes listed for this package. Details Ask about setupInclude the package name and your Magento and PHP versions. Ask
$0.00
In stock
SKU
panth-product-attachments
Links
composer require mage2kishan/module-product-attachments
SKU
panth-product-attachments
  • Package requirementsRead the source documentation
  • Developer profileView Upwork profile
  • Themes listedHyvä + Luma
  • PHP versions listed8.1, 8.2, 8.3, 8.4
  • Installation questionsDiscuss your store setup

What it does for your store

The main features, as listed in the module documentation.

  • One record, many pages

    Upload files or add one external link to an attachment, then assign it to any number of products, categories and CMS pages.

  • Who can download files

    Customer group selection, a guest download switch and an access level of Public, Logged-in Customers or Purchasers Only for file attachments.

  • Files kept private

    Uploads are stored under var/, outside the web root, and served through a download controller. The file type must match its extension.

  • Download log

    Each file download is logged with customer, IP address, user agent and time in a Download Analytics grid, with a daily cleanup cron.

  • Hyvä and Luma blocks

    List or table view with file size, description and PDF or image preview; a tab on Luma product pages and a widget for CMS content.

Installation

Example commands from the Magento root. Follow the package instructions and your staging and deployment process.

  1. 1Check the releaseMatch Magento, PHP, theme and dependency requirements.
  2. 2Install on stagingReview Composer changes and follow the package instructions.
  3. 3Configure and verifyUse the documented settings and test the affected features.
magento-root
$ composer require mage2kishan/module-product-attachments
$ bin/magento setup:upgrade
$ bin/magento setup:di:compile
$ bin/magento setup:static-content:deploy -f
$ bin/magento cache:clean

Listed requirements

These are the details supplied in this listing. Confirm the selected release supports your Magento edition, PHP and storefront.

Magento versions listed2.4.6, 2.4.7, 2.4.8
PHP versions listed8.1, 8.2, 8.3, 8.4
Themes listedHyvä, Luma
Composer packagemage2kishan/module-product-attachments

Read package requirements and license

Documentation

Product details and setup guidance. Check the package repository for release-specific instructions.

Overview

Product Attachments (Panth_ProductAttachments) lets store admins upload files or register external links and show them as downloads on product pages, category pages and CMS pages. It suits stores that publish manuals, datasheets, brochures, size guides or safety documents next to their catalogue.

These are files the store publishes for shoppers to download. If you want customers to upload their own files with an order, that is the separate Order File Attachments module.

What you get

  • An attachment record holds one or more files, or a single external link (http or https only). Assign it to any number of products, categories and CMS pages, from the attachment form or from the product, category and CMS page forms.
  • Allowed file types: pdf, doc, docx, xls, xlsx, ppt, pptx, txt, zip, rar, jpg, jpeg, png, gif. The detected content type must match the extension, and HTML, SVG, XML, JavaScript, PHP, shell scripts and executables are always rejected. An optional maximum upload size applies on the server.
  • Files are stored under var/panth/productattachments/, outside the web root, and streamed through a download controller that checks access first.
  • 21 attachment types such as User Manual, Datasheet and Brochure are created on install, each with an icon, store views and a sort order.
  • Per attachment: customer groups, store views, an expiry date and an access level of Public, Logged-in Customers or Purchasers Only. Purchasers Only checks the customer's processing or complete orders for an assigned product. These checks apply to file attachments; a link attachment opens its external URL directly, so the access level cannot restrict it.
  • List or table display with optional file size, description and inline preview of PDF and image files.
  • A Product Attachments Widget for CMS content and layout containers.
  • An Unused Files grid that finds uploaded files no attachment uses and lets you delete them.

Where shoppers see them

On Luma the product page gets an Attachments & Downloads tab; on Hyvä the block sits in the main product info column. Category pages show the block after the product list, and CMS pages at the end of the content. Hyvä templates are picked automatically when a Hyvä theme is active. Saving an attachment refreshes the cached pages that show it.

Download log and privacy

With Enable Download Tracking on (the default), every file download writes a row with the attachment, the customer ID and email for logged-in customers, the IP address, the user agent and the time. The Download Analytics grid shows these rows, and a daily cron job deletes rows older than Log Retention Days (90 by default; 0 keeps them). Link attachments open the external URL directly and are not logged. Turn tracking off if you do not want this data. An optional email can be sent to one address on every download.

Requirements

  • Magento Open Source or Adobe Commerce 2.4.4 to 2.4.8.
  • PHP 8.1, 8.2, 8.3 or 8.4.
  • Panth Core, installed by Composer as a dependency.

Free and open source under the MIT License.

Developer notes

  • PHP namespace: Panth\ProductAttachments. Route front name productattachments on both the admin and storefront routers.
  • Service contracts: Api\AttachmentRepositoryInterface (save, getById, delete, deleteById, getByProductId, getByCategoryId, getByPageId) and Api\AttachmentTypeRepositoryInterface (save, getById, getByCode, delete, deleteById, getActiveTypes).
  • Access checks: Helper\Data (canDownload, isPurchaseRequired, hasPurchasedAttachment, hasPurchased, isExpired).
  • Custom listings: Block\Attachment\Renderer is the base frontend block. Model\ResourceModel\Attachment\Collection has addActiveFilter, addStoreFilter, addProductFilter, addCategoryFilter, addPageFilter, addTypeFilter, addNotExpiredFilter and addAccessLevelFilter.
  • Full page cache: the frontend blocks read the customer group and login state from the HTTP context (Magento\Customer\Model\Context), which the cache varies on, so cached pages show the attachments of the visitor's group.
  • Email template ID: panth_productattachments_download_notification.
  • ACL resources: Panth_ProductAttachments::productattachments, ::attachment, ::attachment_save, ::attachment_delete, ::type, ::type_save, ::type_delete, ::unusedfiles, ::analytics and ::config.
  • Tables: panth_product_attachment, panth_product_attachment_file, panth_product_attachment_type, panth_product_attachment_version, panth_product_attachment_download_log, panth_product_attachment_store, panth_product_attachment_product, panth_product_attachment_category, panth_product_attachment_page and panth_product_attachment_type_store.
  • Relation rows are deleted by foreign key when the attachment, product, category, page or store is deleted.
More information
Module Category Catalog & Products
Best For All Sizes
Kishan Savaliya

Questions before you install?

Send me your composer.json and I will check for conflicts first. Free. Installation is +$45, custom work is quoted first.

Ask on WhatsApp