For more details see the Product Attachments extension page.
Provide customers with additional details about the products they purchase in your store. The extension allows you to add manuals, licenses, warranties and other downloadable information right on product pages. Equip your attachments of any format with catchy icons to attract customers' attention.
To configure general extension settings please go to Stores → Configuration → Amasty Extensions → Product Attachments.
Expand the General tab.
Enable Module - enable or disable the extension by clicking 'Yes' or 'No'.
Add Category Files to Products - if YES, the files will be attached to all category products. If NO, the files will not be attached to the products of the category. But you can display the category attachments with the help of widget.
Display `Include In Order` Files on Product Pages and Widgets - enable this option if you want to show files regarding ordered products on product pages and widgets.
Url Creation Type - select the type of URL that will be applied to the attachments: ID or Hash.
Hash type URL example:
Show `Product Attachments` Tab - enable display of a new tab with product attachments in the description block on a Product Page.
Tab Title - specify the name for the tab with product attachments.
Choose Customer Groups to show the Tab - specify customer groups for which the attachments will be visible.
Show File Icon - make attachments more noticeable by showing file icons or turn off this option if needed.
Show File Size - enable this option to let your customers know about the size of the attachment.
Tab Position - specify the position for the product attachments among the other tabs.
Show Attachments - enable this option if you want to show attachments for ordered products.
Title for Attachments Block - specify the title for attachments block on the Order View Page.
Type of Attachments to Display - show all product attachments or include them to the order only.
Order Status - choose order status according to which the attachments will be displayed. It is useful if you want to show files only when a purchase is completed.
Show or Hide File Icon and File Size.
Add Attachments to Transactional Emails - include files to transactional emails to provide customers with the maximally detailed product description.
Title for Attachments Block - specify the title of the block that will be displayed in emails.
Type of Attachments to Add - add all the attachments or ‘Include in Order’ only to your transactional emails.
Order Status - select the status(es) that the orders must have to show attachments. Leave the field empty to show attachments in all statuses.
Autodetect File Mime Type on Download - set the option to 'Yes' to let customers open attachments in a new browser window instead of downloading them.
To add new files for a specific product please go to Catalog → Products and open the necessary product. Then expand the Product Attachments tab.
This handy grid allows you to manage all existing attachments easily:
Icon - define a needed attachment by catchy icons to add to the product.
File Name - specify a relevant file name for your internal use.
Extension - track the attachments easily according to file extensions.
Label - fill in the label that will be displayed on the frontend as the name of the attachment.
Customer Group - specify a customer group for which the attachment will be visible on the frontend.
Include In Order - enable this option if you want to display the product attachment in the tab 'My Orders' on the frontend.
Visible - modify this option to hide or display the attachment regarding the product.
You can make the following actions right from the admin panel:
Click the Add Existing Attachments button to add files that are already loaded. Click the Add New Files button to add a new attachment for the related product. Click the Add New Links button to provide your product page with a necessary link.
To see all the attachments please go to Catalog → Attachments Management.
This handy grid helps you track all existing files by ID, icon, attachment type, file name, file label, mime type, and file size.
You can add new files to the existing list right from the grid by clicking the Add New Attachment button.
Specify the Attachment Type and fill in the Attachment Name, Label and then choose a Customer group to which display the file. Then press the Upload button to select a necessary file.
In one click you can regulate the file visibility and include it in order.
Also you can attach a new file to any category and product you need. Just select necessary categories and add products to attach a new file to them.
Then press the Save Attachment button to finish the new attachment adding.
Make attachments more noticeable for customers with catchy icons. To create a new attachment icon or edit already existing ones go to Catalog → Icon Management.
This handy grid allows you to track all existing files by thumbnail, icon type and extension. You can easily check the icon status in the same place.
The module let you add a new icon right from the admin panel by pressing the Add New Icon button.
Upload the icon you need, specify the file type for which the icon will be used. You can enable the icon displaying in one click. Then add the file extension by pressing the Add Extension button.
Hit the Save Icon button to finish the new icon adding.
To attach files to any product category, please, go to Catalog → Categories and select any product category to which you want to add files.
Then, expand the Product Attachments tab. You can add existing or new files or even add new links to the chosen product category. Then press the Save button to attach added files to the certain product category.
With the extension it is possible to add Product Attachments Block to any page or position via widget.
To configure the widget, go to Content → Elements → Widgets.
Click the Add Widget button.
Type - select the Amasty Attachments Block widget type.
Choose the theme and click Continue.
Set the Storefront Properties of the block.
Widget Title - specify the title for the internal usage.
Assign to Store Views - select store views where the widget should be displayed.
Sort Order - set the position of the block in the same container.
In the Layout Updates section you can set any category or product page to display the widget.
Specify the particular categories or products if necessary. In the Container dropdown menu choose where attachments block should be placed. Add as many pages and positions as you need.
Expand the Widget Options tab.
Block Title - specify the title that will be displayed on the frontend.
Widget Type - choose the type of the widget.
You can also Show Icon and Show File Size or hide them if necessary.
Hit the Save button.
Due to the advanced Magento 2 file attachment manager tool you can view and analyze detailed reports on file downloads. Here you can see statistics on what attachments were downloaded, when this happened and who downloaded the file.
To see reports on file downloads please go to Reports → Downloads.
In case you want to refresh the reports download history, click the Clear File Downloads button.
You can place attachments in the product description block via widgets.
Customers can find all attachments regarding completed orders in their accounts. When they view a necessary order in the tab ‘My Orders’, they find corresponded files. All this prevents from losing important documentation regarding the purchased product and its usage.
The extension allows you to place attachments in absolutely any location on product, category and CMS pages via widgets.
With the extension you can import attachments in bulk and assign them to products via CSV-file import.
Go to Catalog, choose Mass File Import in Product Attachments tab.
All incomplete imports are saved and displayed in the grid. To complete any of them, press the Continue button. To start a new import process, click New Import.
In this tab upload all the attachments you want to import via Add New File button.
You can change files' names and labels if needed, assign them to the necessary customer groups, include in order and make them visible/invisible right in the grid.
Here specify store views to which you want to import files.
In this tab CSV-file is generated.
Press Generate import file to download an import sample file.
In the sample you can edit any data presented in Step 1.
In our case we've selected 2 store views.For example, we have English store view (store_id - 1) and French (store_id - 2). So we can name the same file differently and assign to different categories, customer groups, etc.
Set Add in 'Import Behaviour' tab.
Press the ‘Import’ button to import stock data.
You can track and manage all the files of the Product Attachments extension with an API development environment - Postman. A handy HTTP client allows to create all necessary queries, put them into collections, and test apps automatically.
The environment is set up in 3 steps:
2. Set the following variables:
The specified variables can be used in further queries.
To work with API, you need to authorize and get admin token.
Hit the Send button.
The token will be generated in the response to the request.
In Magento 2 Product Attachments admin can view, upload, edit and delete files.
In Postman the queries are the following:
To test file uploading, use the POST query. First of all, encrypt the picture in Base64. To upload the file, insert “string” into “base64_encoded_data”. This is how it reads: “base64_encoded_data”: “string”:
We add the loaded file “tmp_file” and write out the file data: name, label, etc:
Before saving the file, make sure it was loaded. Check it with the help of a pre-request script. This script should be run before the actual request:
Make sure the data on the file match our Magento 2 Product Attachments settings:
The file has been saved.
Get queries let you output the information on a certain file attached to a product. Admin can perform this operation for Default Store View and for All Store Views.
If the file is missing, upload and save it.
Postman allows to create search queries by any specific attribute. You can also sort the search results the way you want to, reorder them and set the number of the results to be displayed in the response section:
Let's see an example.
You are going to search for the attachment with the name starting with “filename” and with the size greater than 3000 Bytes. And you want the results to be sorted by id in the ascending order with 5 files per page.
Start with breaking the query into lines:
1. File name starts with “name”:
searchCriteria[filterGroups][filters][field]=filename& searchCriteria[filterGroups][filters][value]=name%& searchCriteria[filterGroups][filters][conditionType]=like&
2. The size is greater than 3000 Byte:
searchCriteria[filterGroups][filters][field]=size& searchCriteria[filterGroups][filters][value]=3000& searchCriteria[filterGroups][filters][conditionType]=gt&
3. The results are sorted by id in ascending order:
4. The number of files per page is 5 and the number of page for viewing is 1:
The file is deleted.
Check the result in the extension settings:
Now you are sure the file has been deleted.
While the Backend API testing deals with admin users’ interactions, frontend API testing does the same for the customers. The operations they perform are not the same.
To test operations that customers perform, you need to log in as a registered customer and get a customer token.
The algorithm is similar to the process of getting an admin token.
Unlike admin users, visitors and customers can only view or download files. You can test it using Get queries.
To see the attachments of a given product available for a registered customer in a particular Store View, use the GET method.
To use the Customer Token you have got previously, input in the Token field:
Here we see that 2 files are attached to the product with the specified ID:
Let's check how it works for NO Logged In Customer.
The extension allows to adjust file display according to the Store View.
Here is the example on how it works for Default and, say, Germany Store Views. To test that we need GET query.
Specify the Store View and the product ID in the URL for Default and Germany Store Views.
Thus, the data on attachments for each Store View is displayed correctly:
This query concerns products in the required Store View. On the frontend, these files are displayed on the Order page.
Now we are going to consider the case when outputting the info on attachments in the necessary Store View needs adding extra parameters to the URL (category, product, order).
As usual, GET query is used.
Another option of Product Attachments is that users can also output or view the data on the files attached to the whole category.
In the URL, specify the Store View and the ID of the categories we aim to extract file info from. Here are the expected results based on the module configuration:
Now we should check how the info is rendered in Postman:
We see that there are 2 attachments in the ID 4 category and only one attachment in ID 5 category. This matches the module settings and the info is correct.
In this case, we are going to extract the file info for the Default Store View, relying on the file ID.
We have added the ID of a non-existing file (1111) on purpose. As you can see, Postman didn’t report any error. The tool just output the existing files.
In the URL input the necessary Store View, in the Params section – the file/product/category ID.
There are several ways to get the file content. We provide the file settings in the module settings and their representation in Postman.