XML - YML Feed
The Internet price list format with arbitrary tags is a serial data stream, and therefore, is the most convenient way to transfer information through communication channels.
XML is widely used to generate price lists. Take note that this format without predefined tags is not the same as the Excel XML table format (XML Spreadsheet 2003 for Windows and XML Spreadsheet 2004 for Mac).
A price list in the format "XML Spreadsheet 2003" is a regular tabular price list. It opens in Excel as a table, the column numbers of which are visible on the top.
No separators are required when setting up a supplier form for processing price lists of this type.
xml/yml format with custom tags
Also has rows and columns delimited by tags on both sides. If you open the file with Notepad++ or Notepad, you can see the product as a price list line:
The image above shows that each product in the price list begins with the <offer tag (with a space at the end) and ends with the </offer> tag (underlined in red lines).
The space at the end of the <offer tag is necessary so that the plugin does not perceive the <offers> tag as the beginning of the next product.
Columns are numbered in red in the example. These are the same column numbers that are used in setting up the supplier form.
The <offer tag is not the only tag that a price list product can start with. This format "with arbitrary tags" allows any tags to be used:
for example, tag <model, item, product, etc.
The repeated tags in the file are an array of data represented in a table in one column. For example:
The <pictures> column contains three product image links. In a tabular price list, it would look like this:
The plugin uses its own separator |*|
And the <param column would span two columns of the tabular price list 9 and 10:
The xml-yml format with arbitrary tags allows placing a list of categories at the beginning of the file. If this list is built according to the following standard
then the plugin can work with it:
- Create categories
- Fill in the "Category and Margin" tab
XML Feed. Column Numbers
Since it is not always possible to open a price list in XML or YML format with arbitrary tags with Excel to see the column numbers, a special function has been added to the plugin:
In some cases, you have to fill in not only the product start tag but also the end tag:
The plugin will check up to 10,000 products and list the column numbers in the file admin/uploads/columns.tmp
These are the column numbers that should be used in the supplier form.
The content of the columns.tmp file is something like this:
If you select only a few products from the price list into a separate file, then the column numbers may turn out to be other, since some columns may appear in the products later. For example, the <vendor> column only appears in the fourth product:
if you select the first 3 products in a separate price list, the plugin will not see the <vendor> column. What would never happen in the case of XML Spreadsheet 2003-2004 format price list:
Here column #3 always exists, even if it is empty.
The supplier can for some reason remove the <vendor> tag from the price list, then the columns will shift, the column numbers will change and the supplier form settings will be incorrect. Also, he can swap tags and add new ones.
In order not to set the supplier form every time it changes (especially since it is impossible to do this when processing the file via Cron), it is better to create your own column order and, thus, fix their numbers, as in a tabular price list.
To do this, you need to create a file in any text editor containing the column names in the order that suits you. The file should be named user_schemaN.csv (where N is the supplier form number):
and keep it in the admin/uploads folder:
The column names should be copied from the columns.tmp file:
For example, to update prices and quantities, it is enough for us to have a price list with only three columns: SKU, price, and quantity. Then the contents of the file user_schema14.csv will be as follows:
(разделитель - запятая, пробелы не допускаются).
In the supplier form settings, it will be enough to fill in:
- column #1 - SKU
- column #2 - price
- column #3 - quantity
and set the action to "Update only".
XML Feed. Categories
Automatically add categories in Opencart
The plugin can create categories in the store automatically using the categories list located at the beginning of the price list:
The category list is required to be exactly like this as in the image (CRLF denotes a line break ).
It is enough to choose this action:
save the supplier form and process the price list.
In this case, there is no need to manually create reference top-level categories.
Filling in the "Categories and margins" tab
In each product, the junior category is represented, usually in the <category_id> tag with its id:
This id appears in the categories list located at the beginning of the price list (see the image above). By matching this data, the plugin can automatically fill in the "Categories and Margin" tab, both the left side tab and the right side:
The result will look like this:
The image folders have to be created and filled in manually, however, this process can be automated if you enable this action:
XML Feed. SKU
XML price lists with arbitrary tags can contain product SKUs in a separate tag:
(see the image above - column number 7 <sku>).
In this case, column #7 can be used as a product SKU. But usually, the suppliers recommend their product id (column #1) as the more reliable.
And they are right. But if you have several suppliers, then theoretically, different product ids from different suppliers can by chance match.
In 95% of cases, it is most convenient to use the id tag as SKU
If in products, in addition to the id tag, there is also a group_id tag we can assume that the supplier price list contains products with options.
You can see that the group_id tag is repeated in different products, resembling a price list with options on different lines.
In such cases, group_id (column 3) should be selected as SKU.
The group_id tag can also be used to create product series.
Series are used as an options alternative.
To group products in series, it is enough to fill in the column number containing the series attribute group_id in the "Series" field of the supplier form:
Optionally, you can specify both the column containing the sort order and the column with the product icon:
The icon image has to be uploaded to the image/catalog/ folder in advance, and in column 9 of the price list the image path should be in the following form:
XML Feed. Attributes and Options
It should be
Theoretically, options and attributes should be in different tags. For example:
Such a representation of options and attributes in the price list:
allows you to easily set their add or update.
The option name is to the right of the value because column 12 is to the right of column 11
Unfortunately, suppliers often combine attributes and options in the same tag:
1. In order for the plugin not to add the Color and Size options as attributes, or the Warranty, Composition, and Brand as options, you should create these options and attributes in the OpenCart admin panel in advance manually and set the plugin to not create them automatically:
This way in products, only those options and attributes that were created in the admin panel in advance will be updated.
2. Load each option and each attribute separately: