Attributes
"Attributes" or "Characteristics" are rarely changed product part. Most often, they are created and added to the product during its import, in add mode.
Before adding them to the product, the attributes are created in the OpenCart admin panel:
and can be grouped in "Attribute Groups".
Attribute Groups
An attributes group contains related attributes that can be compared under Product Comparison. For example:
- attribute group describing product design: color, shape…
- attribute group describing technical characteristics: power, speed…
- etc.
You should not create attribute groups that can themselves be attributes, for example: "CPU frequency".
Notice
When installing the plugin, attribute group #1 called "three spaces" is automatically created. Don't delete it!
Optionally, it can be renamed to "General" or something else which is appropriate for your site.
Group #1 is used by the plugin when parsing attributes and it has no way of determining which group each attribute belongs to.
From the donor's site web page, the attributes are always parsed to Group #1
If the attribute is added from the price list, then its Group can be specified using the symbols ->
The plugin does not automatically create attribute groups, it uses ready-made groups manually created in advance.
Attributes
Like an attribute group, each attribute has its own ID (attribute_id), which is assigned to it by OpenCart during creation.
Only the Attribute ID is recorded in the product data, not the name, which makes it possible to change the attribute names in the admin panel so that it changes in all products at once.
Unfortunately, this also makes it possible to create multiple identical attributes with different attribute_ids.
The plugin can create attributes automatically in the OpenCart admin panel. This is the option "create" underlined in red in the "Attributes" settings:
And after creation, add the attribute to the product, the option "add".
By default, the attribute name length in OpenCart should not exceed 64 bytes (32 Cyrillic letters). After the plugin installation, this value will increase to 256 bytes.
However, it happens that the attribute name length still turns out to be longer and is cut off when writing to the database. As a result, the attribute name will contain a truncated character (an illegal character). In this case, the plugin will not be able to determine that such an attribute has already been created and will create duplicates.
Attribute duplicates
Each duplicate will get its own attribute_id and will be added to the product. It turns out that a separate attribute has been created for each new product. Since each attribute is linked to the product, it will be impossible to delete them in the admin panel.
The "Delete duplicate attributes in admin" tool will help to fix the problem. But before using it, you need to rename the duplicated attributes in the admin panel to something short and identical for all duplicates, for example, "abc"
The tool will look through all the products in the store and overwrite the attributes in products "abc" with different attribute_id, to one attribute "abc" with one attribute_id, and the rest "abc" attributes will be removed.
Attribute values
Attribute values are not created in the admin panel, but are asigned directly to the product. The value can be of unlimited length and can consist of multiple values separated by commas:
Technical: vertical,horizontal
There are some Opencart Filter modules that can separate the attribute values by predefined separators (comma, semicolon…). In this case, the Filter will be able to filter the products both by the value "vertical" and by the value "horizontal"
In the "Tools" tab there are functions for working with attribute values:
The names of the functions are self-explanatory, and functions 1 and 2 are explained below.
1. Delete the duplicate values in the attribute (Field1).
Let's say the following attribute was added to the product:
Technical: vertical,horizontal,vertical
After applying the Tool, the extra word in the attribute "Technical" will be deleted in all products:
2. Find and Replace in attribute values
This tool applies to all attribute names and all values:
Here, you can replace "watt" to "W", "kilogram" to "kg", "gram" to "g" etc.
If an attribute value is used in the Opencart default filter, then when changing it in the product, it is also necessary to change it in the Filter:
Product Attributes
There are three ways to add attributes to products, depending on the source data.
1. Import from the price list (attributes are not created)
If the attributes are displayed in columns in the price list
it is enough to enter these column numbers on the "Attributes" tab in the supplier's form:
select the appropriate site's attribute in the drop-down menu and set the import rules on the "General" tab:
If there is no corresponding attribute in the drop-down menu, then you need to create it manually in the OpenCart admin panel in the "Attributes" section.
The plugin will not automatically create attributes using the price list header's titles. These texts are arbitrarily added by the supplier and are not reliable.
The image above shows that the values from column 5 are loaded into the store attribute, which belongs to the "Technical" group, and the rest of the attributes selected in the menu belong to Group #1, which is called three spaces.
In the "Tools" tab, there is a function "Export - attributes in columns", which exports the selected products into a price list, displaying each attribute in a separate column (see the first image).
The price list obtained after this export can be used to redistribute attributes in Groups:
using this action:
Notice: the product is not updated if there is no price, the quantity is exhausted or there is no data on price or quantity. Attributes will not be updated for such products.
2. Import from the price list (attributes are created automatically)
For the plugin to automatically create an attribute in the OpenCart admin panel, in the price list, the attribute name should be next to its value, on the right or left. It is also possible to indicate the attribute group as well:
If the attribute group is not specified, the plugin creates an attribute in Group #1 - three spaces.
"Attributes" tab settings:
Значения атрибутов, здесь, находятся в четных колонках прайса 2, 4 и 6, а названия - в колонках слева.
Attribute names can also appear in the columns on the right. In this case, the settings will be like this:
In the "Tools" tab, there is a function "Export", which exports the selected products to a price list, displaying all attribute values in an even column.
It seems that the attributes are arranged randomly, but this is only at first glance. The name of each attribute is to the left of the value:
and setting up the "Attributes" tab will be simple: only even numbers are written in the fields on the left, starting from the number 104:
Life hack
You can export products so that you can see which products are missing a particular attribute.
For example, you need to know which products do not have the "Warranty" attribute in order to add it:
As a result, only one attribute is exported:
As can be seen, the "Guarantee" is missing in products 1, 5, and 6.
Attributes. Parsing
One line of settings is enough to parse all attributes that are present on a web page.
Let's say the donor site page link is in column 12 and the attributes are in the area delimited by the parameters id="tab-specification"> and </table
"Keytext to begin,end parsing" will be: id="tab-specification">,</table
Attribute names are placed between <td> and </td>, as well as attribute values. Therefore, the parsing parameters will be: <td>,</td,<td>,</
Final settings:
- column number 12 has to be entered here:
- set general attribute import here:
Note In price list column 12, there may not be a link for parsing, but a product description containing attributes:
in this case, you can parse the description text into attributes. The parameters are the same.
Conclusions
- For attribute parsing, the column number containing the web page link has to be indicated on the supplier form main page, in the "Product Name" row
- Filling the "Attributes" tab with parsing parameters is not a sufficient condition for attribute parsing. You have to set the attribute import rules on the supplier's form first tab
- For attribute parsing, two parsing parameters are not enough (as for parsing a title or description). 4 parameters are needed: 2 for attribute name and 2 parameters for attribute value
Exceptions
1. In some cases, not 4 parameters are used, but 3. For example:
Here, the attribute's name second parameter semicolon is also the attribute's value first parameter. Therefore, there can be used only 3 parsing parameters:
and that's enough.
2. You can parse attributes separately. For example, you need to take only one attribute: "Power" (see image above):
In such cases, only 2 parsing parameters are used, but "Keytext to begin,end parsing" is required.
Attributes. Filter
Default Opencart filter
Unlike additional filtering modules that use product attributes and options, the default OpenCart filter works with filters and filter groups pre-created in Admin -> Filters.
Using the site's filter allows visitors to quickly and conveniently find the desired product groups without browsing through dozens or hundreds of categories:
In this example, filter groups are marked in red. The filter groups should be created manually in the admin panel in the "Filters" section:
The plugin will do the rest of the work.
Filters import
The following sequence of actions is recommended:
1. Make an export of products belonging to a certain category ("Tools" tab):
In the export price list (file admin/uploads/ex.xml) find the columns with product attributes:
2. Set up product attributes update, as follows:
3. Set the attribute update rules in the supplier's form first tab, save the form, and start file processing.
As a result, filters in groups will be created in the admin panel:
and in the products in the "Links" tab the filters will be filled:
Comma-separated attribute values are added as separate filters.
4. In the admin panel, go to the category whose products you exported (in our example Laptops & Notebooks ->Category Filter Demo ) and select the filters that should be shown in this category:
Attributes. Unification
If you created a product filter in a store, you probably encountered such an unpleasant phenomenon as a different spelling of attribute values that have the same meaning.
The filter does not recognize the meaning of the attribute values and may build a strange selection:
GPS: Yes / Available / Built in / Integrated / + / built-in
To avoid confusion, the attribute GPS should only have two values (Yes or No) and not six.
The plugin can fix this.
Steps to follow
1. First, you need to remove the unnecessary attributes don't in use in any products. Tools tab, three clicks:
2. Then, use the "Delete duplicate attributes in admin" tool after renaming the attributes the same if they have the same meaning:
3. Export all attribute values to a convenient for editing table. Tools tab three clicks:
Wait while the plugin collects and sorts attributes from all products. As a result, you will get a admin/uploads/ex.xml file that looks something like this:
To the right of each "Attribute Value" column is an empty "New Value" column, in which you can enter a new, correct attribute value:
If you enter the value "0", then the old attribute value will be deleted.
4. Save the file on the server as attribute.xml in "XML 2003 Spreadsheet" format
5. Run the tool "Import/Update product attributes". Tools tab:
6. Wait for the plugin to complete its work.
Important
If you leave the attribute.xml file in the admin/uploads/ folder on the server, then the product attributes will be adjusted automatically on the fly when importing new products.