Getting Started
Welcome to the Product Attachments user manual.
You can find all the information you need in order to set up attachments on any page of your site here.
Go ahead, dive in!
- Please go to My Downloadable Products section of our store and find your Product Attachment module.
- Learn how to install the extension here, and follow our Quick Start guidelines in order to add your own attachments in no time.
- If you are interested in the module's more advanced features, check the manual's Configuration section.
How to install the extension
Installation via composer (preferably)
We recommend this installation method because the composer automatically checks and installs necessary dependencies.
- Back up your store's database and web directory.
- Log in to the SSH console of your server and navigate to the root directory of the Magento 2 store.
-
Copy installation instructions from the page My Downloadable Products to SSH console and press ENTER.
- Run the command
php -f bin/magento module:enable Mirasvit_Core Mirasvit_Attachment
to enable the extension.
- Run the command
php -f bin/magento setup:upgrade
to install the extension.
- Run the command
php -f bin/magento cache:clean
to clean the cache.
-
Deploy static view files
rm -rf pub/static/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy
Installation via direct file upload
You can also install the extension via direct files uploading.
-
Go to My Downloadable Products / View & Download.
- Unpack .zip package and copy contents to magento root directory
- Log in to the SSH console of your server and navigate to the magento root directory.
- Run the command
composer require icomefromthenet/reverse-regex:0.0.6.*
for install required libraries.
- Run the command
php -f bin/magento module:enable Mirasvit_Core Mirasvit_Attachment
to enable the extension.
- Run the command
php -f bin/magento setup:upgrade
to install the extension.
- Run the command
php -f bin/magento cache:clean
to clean the cache.
-
Deploy static view files
`rm -rf pub/static/; rm -rf var/view_preprocessed/;
Install the extension for Hyva
-
Run the command
composer require hyva-themes/magento2-mirasvit-attachment
-
Enable installed Hyva modules:
bin/magento module:enable Hyva_MirasvitAttachment
-
Update Magento database schema and data with the command:
bin/magento setup:upgrade
-
Compile the code of the installed extension:
bin/magento setup:di:compile
- Run the command below to clean the cache:
bin/magento cache:flush
Quick Start
Setting up a New Attachment
You can set up a new attachment in the module's settings:
- Go to your Magento admin panel.
Click the Catalog tab in the top left.
- Click Manage Attachments in the pop-up.
- Click Add New in the top right.
- Choose whether you want the attachment to be active immediately in the Is Active field.
- Decide whether you want the attachment to be a file or a link in the Type field.
- Upload the file or paste the URL.
- Select its public name in the Label field.
Note
If you upload a file, the filename (without the extension) will be used as the default label.
- You can choose global sort order for attachment in the Sort Order field.
Note
- If several attacments have the same Sort Order value, they will be sorted by attachment_id.
- You can drag and drop attachments in the attachments tab on the product or category edit page.
- (Optional) Select the attachment's icon. If you would like to use different icons, please follow the guidelines here.
Note
- If you do not select an icon, the default icon associated with the file type will be used.
- If there is no icon associated with the file type, a generic file icon will be used.
- If you add a URL, the URL icon will be used.
- Choose the customer groups that will be able to see the attachment in the Customer Group Ids field.
- Select which store views will have the attachment in the Store View field.
- Click Save in the top right.
You can also set up new attachment while editing a product, category or a CMS page:
- Start editing the relevant page.
- Scroll down to the bottom.
- Expand the Attachments section
- Click Add New Attachment
- Go to Step 4 of the guide above.
Adding an Attachment to the Page
Useful Info
You can add more than one attachment to a single page.
You can assign an attachment to several pages from the attachment's settings:
- Create a new attachment by following the guidelines above or navigate to an existing attachment and click Edit in the rightmost part of the grid.
- Expand the Products section, click Add Products and select the product pages where you would like to add the attachment.
Note
If you would like to further customize how attachments are displayed on the product page, follow the guidelines below.
Product Page Configuration
You can further customize the way your attachments appear on the product page.
Customizing the Product Page Attachment
- Click the Catalog tab in the top left of your admin panel.
- Click Configuration in the pop-up.
- Choose whether you want the attachment tab to be displayed on the product page in the Display Product Tab field.
Note: Selecting No will remove the attachment from the page.
- Change the attachment tab's name in the Tab Title field. The default name is Attachments.
- Choose the attachment tab's order in the Tab Position field. The default order is 100, i.e. it appears last.
- Click Save Config in the top right.
- Clear Magento cache.
- Expand the Categories section, click Add Categories and choose the category pages where you would like to add the attachment.
- Expand the Cms Pages section, click Add Pages and choose the CMS pages where you would like to add the attachment.
- Click Save in the top right.
- Clear Magento cache.
Alternatively, you can assign several attachments to a page while changing product, category or CMS page settings:
- Start editing the relevant page.
- Scroll down to the bottom.
- Expand the Attachments section.
- Click Assign Attachments.
- Check all attachments that apply.
- Click Save in the top right.
- Clear Magento cache.
Setting up Icons
The Product Attachments module includes icons for most commonly used file types. You can also add your own icons or change existing ones.
Creating a New Icon
- Click the Catalog tab in the top left of your admin panel.
- Click Icons in the pop-up.
- Click Add New in the top right or navigate to an existing icon and click Edit in the rightmost part of the grid.
- Enable or disable the icon by changing the Is Active toggle.
- Add the icon's name to the Label field.
- Upload the icon file in the Icon field. JPEG, GIF, and PNG images are currently supported.
- (Optional) Select which file type you would like to associate with the icon in the Types field. If you add a corresponding attachment without choosing an icon manually, this icon will be used automatically.
Note
Choosing a url file type will make it the default icon for URLs.
If you do not specify any file type, it will become a generic icon for all file types without their own icons.
If you add several icons associated with the same file type, the icon that is highest in the grid will be used.
- Click Save in the top right.
Customizing the Product Page
You can further customize the way your attachments appear on the product page.
Customizing the Product Page Attachment
- Click the Catalog tab in the top left of your admin panel.
- Click Configuration in the pop-up.
- Determine whether you want the attachment tab to be displayed on the product page in the Display Product Tab field.
Note
Selecting No will remove the attachment from the page.
- Change the attachment tab's name in the Tab Title field. The default name is Attachments.
- Choose the attachment tab's order in the Tab Position field. The default order is 100, i.e. it appears last.
- Click Save Config in the top right.
- Clear Magento cache.
Checking the Attachment's Performance
You can check how many times the attachment has been clicked on throughout the day (12 AM to the current time), during either the last 30 days or for all time.
- Click the Catalog tab in the top left of your admin panel.
- Click Manage Attachments in the pop-up.
- Review the attachment's performance in the grid's Downloads column.
Creating an Attachment Widget
You can make a widget with several attachments. It will help you to streamline the content update.
Note
Make sure you have already set up all the necessary attachments.
- Click the Content tab in the top left of your admin panel.
- Click Widgets in the pop-up.
- Click Add Widgets in the top right.
- Select Attachments in the Type field.
- Select the theme you would like to use in Design Theme field.
- Click Continue.
- Set up the widget's location in the Storefront Properties tab.
- Click the Widget Options tab in the top left.
- Enter the widget's name in the Title field.
- Click Select Attachments near the Attachment Ids field.
- Click on the attachments you would like to add in the popup.
- Close the popup.
- Click Save in the top right.
How to upgrade the extension
To upgrade the extension, follow these steps:
- Back up your store's database and web directory.
- Log in to the SSH console of your server and navigate to the root directory of the Magento 2 store.
- Log in to the SSH console of your server and navigate to the root directory of the Magento 2 store.
If the extension was installed via:
- Composer: run command
composer require mirasvit/module-attachment:* --update-with-dependencies
to update current extension with all dependencies.
Note
In some cases, the command above is not applicable, or it's not possible to update just the current module, and you will need to upgrade all Mirasvit modules in a bundle. In this case, the command above will have no effect.
Instead, run the composer update mirasvit/*
command. It will update all Mirasvit modules installed in your store.
- Direct file upload: download new extension package from our store and copy contents to root Magento directory
- Run the command
php -f bin/magento module:enable Mirasvit_Core Mirasvit_Attachment
to re-enable the extension.
- Run the command
php -f bin/magento setup:upgrade
to install updates.
- Run the command
php -f bin/magento cache:clean
to clean the cache.
-
Deploy static view files
rm -rf pub/static/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy
Disabling the Extension
Temporarily Disable
To temporarily disable the extension, please take the following steps:
- Log in to the SSH console of your server and navigate to the root directory of the Magento 2 store.
- Run the command
php -f bin/magento module:disable Mirasvit_Attachment
to disable the extension.
- Log in to the Magento backend and refresh the store cache (if enabled).
Extension Removing
To uninstall the extension, please take the following steps:
- Log in to the SSH console of your server and navigate to the root directory of the Magento 2 store.
- Run the command
composer remove mirasvit/module-attachment
to remove the extension.
- Log in to the Magento backend and refresh the store cache (if enabled).
Change Log
1.1.14
(2024-12-11)
Improvements
- Added aditional fields to attachment grid (created_at, updated_at, tag)
Fixed
- Handling an error "$_FILES array is empty"
1.1.13
(2024-12-02)
Improvements
- Added ability to load multiple files
1.1.12
(2024-07-12)
Fixed
- Issue with preview of uploaded file in attachment form
1.1.11
(2024-07-09)
Fixed
1.1.10
(2024-04-05)
Fixed
- Filter by Store View
- Undefined variable $links error
1.1.9
(2024-03-26)
Improvements
- Adding global attachment position
1.1.8
(2024-03-13)
Improvements
- Adding possibility to define attachment order on category and product pages
1.1.7
(2023-12-01)
Improvements
- Open the attachment in a new tab
1.1.6
(2023-07-24)
Fixed
- Compatibility with php less than 7.4
- Assign attachment to product on product edit page in Magento EE
1.1.5
(2023-03-15)
Fixed
1.1.4
(2023-03-03)
Fixed
- Error when adding a product if MSI is used
1.1.3
(2022-09-30)
Fixed
1.1.2
(2022-09-26)
Fixed
1.1.1
(2022-06-20)
Improvements
- remove db_schema_whitelist.json
1.1.0
(2022-05-23)
Improvements
- migrate to declarative schema
1.0.1
(2020-11-09)
Fixed
- Analytics for links
- Compatibility with Magento 2.3.x
- Invalidate cache
1.0.0
(2020-10-27)
Improvements