JBZoo Related Items (auto) - automatically related items

7.0/10 rating (4 votes)

Related items

JBZoo Related items (auto) is an element that displays similar products on the website. Your visitors will see not only the main product which they are interested in, but also some parametrically similar products. This element can automatically select similar items so that an administrator doesn’t have to manually pick related items for every product.

You can see an example on our demo website. Just open any product from the “Catalog” section.

How to add JBZoo Related items (auto) element to an item type?

How to open ZOO configurationChoose an applicationTo configure an element, go to the cog-wheel tab and choose JBZoo App.

Editing item type settingsElement location in the Element Library

Find an item type where you want to add an element. Hover it with a mouse and click the “Edit Elements” link.

On the next page you’ll see the “Element Library”. Find “JBZoo Related items (auto)” and click on it.

New element will appear on the left with such settings:

Element configuration in the item type

  • Name - a name that will be used later.
  • Title - a detailed description that is available only to the administrator.
  • Access level - a parameter that specifies what kind of visitors will be able to see this element.

How to add an element to an item template?

Item template layoutsFind an item type where you’ve added new element. In the Template Layouts column choose a template for which you want to configure JBZoo Related items (auto) element, Full, for example.

Dragging an element to a positionFrom the right side choose the element that you’ve added. Drag it to the desired position to the left, depending on where you want it to be displayed.

Description of element settings

Click on the pencil icon in the right side of an element title. You’ll see following settings:

Element settings in an item template

  1. Show label - parameter that allows you to display a name of the element on the website.
  2. Alternative label - another variant of the element’s name that will be used instead of the main one. It will be displayed only if you enable “Show label” option.
  3. Limit - maximum number of related items.
  4. Relevance limit - minimum number of matched fields. For example, if you set this option to 7, only those items will be selected where at least 7 fields match. Maximum value is 30. More about relevance and how it is calculated we’ll describe below.
  5. Search method - method of related items selection:
    • Exact matching of the same fields - search by the fields with exactly same values.
    • Full-text search in the same fields - it is for items in which only a part of a word or a phrase of a sentence may match. Only the same fields are compared, for example, country names.
  6. Check the application - related items will be selected from the application where main item belongs. If you select No, related items will be selected from all applications.
  7. Check item type - this option defines whether item type matters or not. That is, if you choose Yes then related items will be selected from the items of the same type, and if you choose No, items will be selected regardless of their type. But this option works only if core fields will match. This is because system identifiers of custom elements (Element ID) are unique and never equal even if you name them equally, but Element ID of the core fields could be equal.
  8. Check categories - parameter that defines which categories will be used for related items..
    • Use only primary category - only primary category of all items matters.
    • All related categories - not only primary category matters, but additional categories as well.
  9. Choose fields - list of fields that will be used for searching of related items. You can choose one or more fields, both custom and core fields.
  10. Additional conditions - specify an additional condition for selecting related items. You can read more about additional conditions below.
  11. Item output template - template which will be used to display related items. If you choose Item Name, only names of related items will be displayed on the website. All other options of the drop-down list are different templates.
  12. Link Item Name - allows you to display related items as links (only if Item name template is selected).
  13. Number of columns - determines a number of columns for related items. If you select Don’t use, related items will not be wrapped in tags. This is especially useful if you need to display a list of related items as a table.
  14. Separated by - symbol that will separate related items. It is active only if the Item Name template is selected in the Item output template option. This is how items with a Pipe separator will look like:

Separator example

How additional conditions work

Additional conditions option helps you to limit related items by a custom criterion. And real values of fields will be overridden by those that are specified in this option.

For example, we have a clothing shop. We want to display special offers of our shop under every product. So we set following condition in the “Additional conditions”:

_itemtag = Sale

Now, if we open some product, all similar products that have a “Sale” tag will be selected. And it doesn’t matter what tags the main product has, because if Element ID matches additional conditions, its value is replaced with the latter.

So, it’s possible to additionally tweak the result of the search.

How to recognize Element ID?

Where is element ID?

Go to the “Edit elements” of your item type and click on the pencil icon. Custom fields have a unique ID, so you can’t make additional condition for it. But core elements (Edit Core Elements) can match.

For example, you can create a condition _itemcategory = category name, where “_itemcategory” is a key, and “category name” is a value. Or Element ID = blue. Then similar items will be selected not by ID but by “blue” value.

By which fields additional conditions work?

Not all fields can be used in the search. They are listed in the “Choose fields” option. For example, a list of core fields is very limited because there is not much sense to search by the creation date. At least, seconds will be different.

What kind of values can be used in conditions?

Apart from simple values like a number or a word, you can specify multiple values as an array in JSON format. For example, to specify several tags at once, use following:

_itemtag = ["News", "Update", "Download"]

Carefully use double quotes, commas and brackets!

The search will use these values instead of item tags, like it were a repeatable text field.

Notice. Unfortunately, at this moment there is no possibility to specify a range of values or complex data like “sku+stock amount” in the JBPrice Advance element. However, these features and some others are in our to-do list for future versions.

What is relevance and how is it calculated?

Relevance is an evaluation of the extent of items matching by their fields. In this case it is a numerical value that can be used to determine how much one item is similar to another.

Relevance calculation

So how is it calculated? For example, in the Choose fields option for the product of one type we set the following: Tags (core field), Text and Date (repeatable fields). In the settings we will specify that search should check an item type, limit of items will be 2, relevance limit will be 6.

Products in the picture are compared in such way that the search is made separately for each field. Next to them, for illustration purposes, we wrote down every match - it is one point of relevance. By adding these points we receive a relevance for each product.

After that those products with a relevance of 6 and above will be displayed on the website while others will not. Those with more matched fields will be displayed on the first place.

There is no difference between custom fields and core fields for relevance.

Important notes regarding performance of the element

JBRelatedItems (auto) is designed in such way that all database selections are made within one SQL query. Almost all math and relevance calculation is made by MySQL database.

Thus, an optimization of the element’s performance is achieved.

But despite the efforts of developers to accelerate the element, a lot of factors that affect its performance should be considered.

Criteria that affect the performance of the element

  • Number of fields used for a search. For example, a search by one field is 30 times faster than a search by 30 fields (provided other conditions are the same).
  • Limit by type, by application and by categories. When limiting an item by any of these parameters, an amount of similar items will be less, so the performance is better.
  • An amount of products on the website and the total amount of data. If your catalog has a lot of products with repeatable fields, the speed of the search will be much lower than in a small catalog with simple fields.
  • Search method. Exact search usually works several times faster than a full-text because built-in MySQL indexes are used.
  • The performance of your web-hosting and of the database. Since the main part of heavy calculations is made on the SQL query level, performance of the element (and of any website, actually) directly depends on the database. Usually there are no problems with this, even on the cheap tariff plans.

This element has its own caching algorithm which is enabled together with Joomla cache (in general settings). So it is recommended to enable it for large websites. This way you can exclude complex database queries.

There are no universal solution to improve the performance of the element because all websites are different and require an individual approach. So we suggest you to carefully choose its settings.

Category, Elements, Item, Related, Tags, Template

Still gotta questions, who can help me?

Visit our special JBZoo tech support forum which is specifically meant for JBZoo so the priority of the response and its promptness are much better there than in any other place. With inactive account with a “Plus” sign in a tariff plan you can ask for support in one of these sections or use any of our contacts.