Getting Started

Welcome to the documentation of Related Products for Magento 2 extension.

Whether you are a new or an advanced user, you can find some useful information here.

First of all we recommend you check the following link:

  • How to install extension

Installation

How to install the extension

  1. Backup your store's database and web directory.
  2. Login to your server's SSH console and navigate to the root directory of the Magento 2 store.
  3. Copy the installation instructions from the page My Downloadable Products to the SSH console and press ENTER.
  4. Run command php -f bin/magento module:enable Mirasvit_Core Mirasvit_Related to enable the extension.
  5. Run command php -f bin/magento setup:upgrade to install the extension.
  6. Run command php -f bin/magento cache:clean to clean the cache.
  7. Deploy static view files

    rm -rf pub/static/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy

  8. Run command php -f bin/magento indexer:reindex mst_related_index to reindex extension-related data.

  9. Make sure that the native Magento cron job is configured and working correctly. The Related Products for Magento 2 extension runs all tasks in cron.

Install the extension for Hyva

  1. Run the command

        composer require hyva-themes/magento2-mirasvit-related:*
  2. Enable installed Hyva modules:

        bin/magento module:enable Hyva_MirasvitRelated
  3. Update Magento database schema and data with the command:

        bin/magento setup:upgrade
  4. Compile the code of the installed extension:

        bin/magento setup:di:compile
  5. Run the command below to clean the cache:
        bin/magento cache:flush



Product Selection Rules

Selection Rule - This is the internal function that describes the conditions in selecting some appropriate related products.

Go to Marketing > Related Products > Product Selection Rules. You will see the applicable rules.

You can add a Rule by pressing Add New Rule button. You will see then a Rule edit form, which contains the following basic data:

General information

  • Internal Name - the internal name of the rule.

Products Selection Condition

image

Primary Source

Primary Source - the source of some related products. The Related Products for Magento 2 extension selects related products based on:

  • Whole Catalog - all available products (products from the current product page, last added product in the cart, any already purchased products, possible related products)
  • Bought Together (the same Order) - previous orders (products from current product page, the last added product in the cart, any already purchased products, possible related products were bought in the same order)
  • Also Bought (the same Customer) - previous orders (the same customer bought products from the current product page, the last added product in the cart, any already purchased products, possible related product)
  • Viewed Together - previous product viewing history (the same customer viewed products from current product page, the last added product in the cart, any already purchased products, possible related product).

Note

When using the rule "Other Viewed Products" for the Product Blocks, please note that this rule updates the list of related products only if the option "Enable "Product View" Report" is enabled.

To activate the "Enable "Product View" Report", navigate to Stores > Configuration > Reports where you must first activate the option Enable reports. After that, the option Enable "Product View" Report will become available.

Please note that "Other Viewed Products" only takes into account viewed products of logged-in customers.

Use default Magento collections

Under the Primary Source drop-down menu, three additional options are located that allow you to use the default Magento collections.

  • Include assigned Related Products
  • Include assigned Up-Sells Products
  • Include assigned Cross-Sells Products

When the respective checkbox is activated ,the products are first added from default source and after that – products are added by the created rule.

Rule

Rule - additional conditions to specify what products will be considered as related products.

# Product Blocks

Product Block - a block that displays related products on the store's pages.

Go to Marketing > Related Products > Product Blocks. You will see some available blocks.

You can add a Block by pressing Add New Block button. You will then see a Block in the edit form, which contains some basic data:

image

General information

  • Internal Name - internal name of the block
  • Active - to enable/disable block
  • Priority - priority of the block. If a few blocks share the same position on the page, the extension will select the one block with the highest priority
  • Store View - the store view the current rule is applied to

Where To Display

This section defines on what page type and where on this page the block of related products is displayed. For example, the related products block can be placed on product page in several places: inside main content, on sidebar or inside the Magento native related product block.

Note

After changing the position or creating a block, you should clear the Magento cache to apply your changes. Navigate to System > Cache Management > Flush Magento Cache

  • Use predefined position - activates placing the block on Magento predefined pages and positions. For example, here is how the block of similar products looks at the top and bottom of the content section on product page:

image

When this option is disabled you can configure your own position for the block. Syntax: page/container/before/after. Example: catalog_product_view/product.info.extrahint//-

  • Remove Native Related Products Block - removes the default Magento related products block when activated
  • Remove Native Cross Sells Products Block - removes the default Magento cross sells products block when activated
  • Remove Native Upsells Products Block - - removes the default Magento upsells products block when activated

What To Display

This section defines what products would be displayed in the block. You need to configure Product Selection Rules first to be able to choose what products to display. For example, you can configure to display the cross-selling products or similar products.

image

How To Display

This section defines the general appearance of the configured block.

  • Block Title - the name of the block that is visible to the shopper
  • Number of products - the quantity of items to be displayed in the block
  • Use slider - activate if the number of products does not fit inside the block without scrolling
  • Number of products per page - the quantity of products the block should fit without scrolling
  • Template - choose the visual style of the block. Options available: default, bulletproof, widget.

image

How to upgrade extension

To upgrade the extension, follow these steps:

  1. Backup your store's database and web directory.
  2. Login to your server's SSH console and navigate to the root directory of the Magento 2 store.
  3. Run command composer require mirasvit/module-related:* --update-with-dependencies to update current extension with all dependencies.

    Note

    There are some cases when the command above is not applicable; it is not possible when updating the current module; neither will it be applicable when upgrading all the Mirasvit modules in a bundle. In this case, the command above will be of no effect.

    Run instead composer update mirasvit/* command. It will update all Mirasvit modules installed in your store.

  4. Run command php -f bin/magento module:enable Mirasvit_Core Mirasvit_Related to enable the extension.
  5. Run command php -f bin/magento setup:upgrade to install updates.
  6. Run command php -f bin/magento cache:clean to clean the cache.
  7. Deploy static view files

    rm -rf pub/static/*; rm -rf var/view_preprocessed/*; php -f bin/magento setup:static-content:deploy

  8. Run command php -f bin/magento indexer:reindex mst_related_index to reindex the data related to the Related Products for Magento 2 extension.

Disabling the Extension

Temporarily Disable

To temporarily disable the extension please follow these steps:

  1. Login to your server's SSH console and navigate to the root directory of the Magento 2 store.
  2. Run command php -f bin/magento mirasvit:related:cleanup to cleanup related data.
  3. Run command php -f bin/magento module:disable Mirsvit_Related to disable the extension.
  4. Log in to the Magento backend and refresh the store cache (if enabled).

Removing the Extension

To uninstall the extension, please follow these steps:

  1. Login to your server's SSH console and navigate to the root directory of the Magento 2 store.
  2. Run the command composer remove mirasvit/module-related to remove the extension.
  3. Log in to the Magento backend and refresh the store's cache (if enabled).

Change Log

1.2.4

(2024-03-19)

Improvements

  • Command for restore layout after re-enable module

Fixed

  • Table already exists error

1.2.3

(2024-01-26)

Fixed

  • Item with the same ID exists error if the rule condition contains the Current Product Category

1.2.2

(2024-01-05)

Improvements

  • The Display Out of Stock Products option affects Native Related/Up-sell/Cross-sell products added to a block

1.2.1

(2024-01-04)

Improvements

  • Ability to exclude Out of Stock Products when Display Out of Stock Products option is Yes

1.2.0

(2023-12-29)

Features

  • Selecting products by image availability
  • Ability to choose sort order
  • Assigned products are located at the beginning of the block with their position

Improvements

  • Block rendering performance

1.1.34

(2023-11-24)

Features

  • Setting for statistics history lifetime

1.1.33

(2023-11-06)

Fixed

  • Error on the cart page for Hyva theme if the related products block is disabled

1.1.32

(2023-11-03)

Fixed

  • Add into Native Cross-Sell Block for Hyva theme
  • Processing Product Selection Rules for a block on the cart page.

1.1.31

(2023-10-12)

Fixed

  • Processing Product Selection Rules if the same attribute appears several times in a condition

1.1.30

(2023-10-11)

Fixed

  • Processing Product Selection Rules with "is not one of" in the condition
  • Issue with show Stock Status

1.1.29

(2023-10-04)

Fixed

  • Products selection by price for products whose Product Type is not simple

1.1.28

(2023-10-04)

Fixed

  • Products selection for a block if several stores are configured

1.1.27

(2023-10-02)

Improvements

  • Hide slider dots and slider arrows if only one page

1.1.26

(2023-09-13)

Fixed

  • Base Currency in analytics column on Product Blocs page

1.1.25

(2023-07-11)

Fixed

  • Selection rule for grouped product

1.1.24

(2023-07-10)

Fixed

  • Checking Display Conditions when adding products to Native Block

1.1.23

(2023-07-07)

Fixed

  • Error "Item with the same ID already exists"

1.1.22

(2023-07-07)

Fixed

  • Error "Item with the same ID already exists" when displaying a block

1.1.21

(2023-06-27)

Improvements

  • In the module settings added a limit of the last days for indexing

1.1.20

(2023-06-26)

Improvements

  • Added automatic reset of auto_increment to prevent potential integer overflow during indexation.

1.1.19

(2023-06-23)

Fixed

  • Resolved the 'Duplicate entry for key...' error that occurred while opening the shopping cart

1.1.18

(2023-06-23)

Improvements

  • Added additional optimizations to the product selection mechanism that was improved in version 1.1.17

Fixed

  • Resolved the issue of selecting related products for the block (shopping cart)

1.1.17

(2023-06-09)

Improvements

  • Optimized frontend performance (selecting related products with extra large indexes)

1.1.16

(2023-05-10)

Fixed

  • Rule with Current Product in condition

1.1.15

(2023-04-20)

Improvements

  • Reduced indexing time for stores with a large number of orders

1.1.14

(2023-04-04)

Improvements

  • Added left-right swipe handling

Fixed

  • Image display issue in Bulletproof Template

1.1.13

(2023-03-23)

Fixed

  • Issue with removing Native Block

1.1.12

(2023-03-15)

Fixed

  • PHP 8.2

1.1.11

(2023-02-23)

Improvements

  • Added support of Magento 2.4.6

Fixed

  • Save Block button caption
  • Conditions Contain and Not Contain in Product Rule
  • Value change when editing Rule Conditions

1.1.10

(2022-09-20)

Fixed

  • Remove Native Related Products Block and Remove Native Upsells Products Block for Hyva theme
  • Remove Native Cross Sells Products Block

1.1.9

(2022-09-09)

Improvements

  • Add into Native Related Block for Hyva theme

1.1.8

(2022-09-05)

Fixed

  • Error when displaying a block in stores with a large number of products

1.1.7

(2022-08-18)

Fixed

  • Compatibility with Magento 2.4.5

1.1.6

(2022-07-27)

Fixed

  • Issue with saving analytics

1.1.5

(2022-07-27)

Fixed

  • Call to a member function validate() on null

1.1.4

(2022-07-26)

Features

  • Display conditions

1.1.3

(2022-07-07)

Fixed

  • round(): Passing null to parameter [#1]() ($num) of type int|float is deprecated

1.1.2

(2022-06-20)

Improvements

  • remove db_schema_whitelist.json

1.1.1

(2022-06-06)

Fixed

  • SQLSTATE[42S22]: Column not found: 1054 Unknown column "FIELD(e.entity_id...
  • Issue with relative positioning of Related Products block

1.1.0

(2022-05-31)

Improvements

  • Migrate to declarative schema

1.0.24

(2022-05-17)

Fixed

  • Issue with duplicate attribute in rule condition

1.0.23

(2022-05-17)

Improvements

  • update mirasvit/module-core dependency

1.0.22

(2022-05-11)

Fixed

  • Pagination
  • Related product list style when slider is enabled
  • Issue with applying the Number of products setting to a block

1.0.21

(2022-02-23)

Fixed

  • Revenue value
  • Widget template for RTL language
  • Issue with slider

1.0.20

(2022-02-17)

Fixed

  • Cleanup Command

1.0.19

(2022-02-07)

Improvements

  • Decrease products in row QTY for mobile devices

1.0.18

(2021-11-24)

Improvements

  • Quick Data Bar

Fixed

  • Use rule option multiple times
  • Use product list widget for products template

1.0.17

(2021-06-16)

Improvements

  • Added widget
  • Added slider to the related block

1.0.16

(2021-04-19)

Fixed

  • Fix delete message for m2.4

1.0.15

(2020-12-29)

Fixed

  • Issue with logging

1.0.14

(2020-12-11)

Fixed

  • Condition "Current Product ..."

1.0.13

(2020-12-07)

Improvements

  • Ability to replace blocks in the native blocks

Fixed

  • Zen_Json to SerializeService

1.0.12

(2020-11-23)

Fixed

  • Compatibility with m2.1

1.0.11

(2020-10-13)

Fixed

  • Issue with selecting native related product ids

1.0.10

(2020-09-24)

Features

  • use native collecton (related, up-sells, cross-sells)

1.0.9

(2020-08-28)

Fixed

  • fixed an issue with the error 'cookie is not a function'

1.0.8

(2020-07-30)

Features

  • Added GraphQL implementation

Improvements

  • Support of Magento 2.4
  • Selection rules for non-product pages

1.0.7

(2020-07-28)

Improvements

  • Selection rules for non-product pages

1.0.6

(2020-07-16)

Improvements

  • Bulletproof template
  • Added GraphQL implementation

1.0.4

(2020-02-28)

Improvements

  • Order products

1.0.3

(2020-02-25)

Improvements

  • Apply filter by stock (by default only saleable products are suggested)

1.0.2

(2020-02-20)

Improvements

  • Ability to use custom block position
  • Indexation performance

1.0.1

(2020-02-11)

Fixed

  • Minor fixes

1.0.0

(2020-02-06)

Improvements

  • Indexation performance

0.0.1

(2020-01-22)

Improvements

  • Initial release