In this article we will tell you about your experience of integration with Bitrix and about some features of this system from the point of view of an integrator. Our company is engaged in information support of e-commerce catalogs, and in a simple way, we fill online stores and electronic catalogs automatically using internal products. Our responsibilities include filling online stores with merchandise, integrating supplier bases with store databases, analyzing competitor price lists, updating warehouse, prices, etc.
It should also be noted that we already had clients whose e-commerce applications worked on the basis of Bitrix. However, for some reason, they always asked us to provide data in the form of text files of different formats. We did and everything suited everyone. However, a logical question nevertheless arose: Why is the bitrix one, and everyone has different formats?
Finally, one of our customers needed to organize the import of data directly into Bitrix. We downloaded the Beatrix demo for stores and found that it has the ability to import data in a csv format. And since we have been successfully using this format for a long time, it was decided to use it to solve our problem. After evaluating the cost of the project and specifying all the details with the customer, we set to work.
Trying CSV.')
Starting to actually fill in the data, it was found that using the csv format is not very convenient, in view of the customer’s requirement to transfer the parameters of the goods. csv was discarded because importing goods with parameters is very inconvenient in this mode, the bitrix required obscure headers for the csv file, but they were more similar to the internal field names and there was no desire to deal with it right away and it is unlikely that this method would bring the desired result . Those. if you need to do a simple import where you need to transfer the “Product Name”, “Description”, “Price” and “Picture” - then yes - this method will do, but if something more, then you need to look for another method.
Bitrix supports the following import options , we found this out after examining the system in more detail:
- Import via csv;
- Import CommerceML;
- Import XML;
- Import through 1C.
I’ll say right away that in the end I chose to import goods to the store through 1C, and here’s why - read below.
Import using CommerceML.This method which initially seemed the most promising, on the Internet, there are many different articles about what is CommerceML format and how cool that it is such a uniform format for e-commerce. It is strangely true that the official site of this format did not open, but honestly found and downloaded the xsd format, found several examples and began to analyze. The first thing that causes cultural shock is the Russian language in the tag names, but by making a bet on the locality of products and their accessibility for users, it can be assumed that this method is the most suitable for the Russian-speaking population and, accordingly, users. Then we made some test files with our hands and started testing the fill. It didn’t work as we needed and it wasn’t clear why we couldn’t pour prices and stock right away.
Through trial and error, we put a test CommerceML file into XML import and a miracle - something started to appear on the site as we wanted, but still could not display prices - only the nomenclature hung on the site. This podsovyvanie CommerceML file to import XML worked, but it was felt that something is not the same should not be.
Mechanisms 1C.Later it turned out that there is a method that almost everyone uses - and this is an unloading from 1C. Having figured out that uploading consists of two import.xml files and offers.xml and making examples of these files, they started testing them again on the real Bitrix site, alternately loading them into the CommerceML import procedure, then into the XML import procedure, and the desired result was not obtained. Somewhere on the forums there was a phrase that the procedure for importing CommerceML requires the file format 1.x, and the one we generated was version 2.x, so I started to figure out how to import these import.xml and offers.xml which were obviously valid, but for some reason they didn’t want to be displayed in the store.
Having clearly understood that it is necessary to learn how to import these two files and knowing that they are generated from 1c, there appeared an understanding that it is necessary to 1c in order to import them. 1C can do this via the web. 1C receives as a parameter a link to a web processor (you can say a service), during the import process 1c transfers files to the site, and then sequentially imports two files. I already wanted to write a 1c emulation program, but suddenly I came across an interesting extension for Bitrix, which emulates importing from 1c directly from Bitrix! Bingo, now everything has come together.
Further, the process of setting up the import process from the import.xml files and offers.xml without 1c to the Bitrix-controlled store, without using 1c, will be described.
Important steps of the import process in Bitrix mechanism through 1C:1) In order to do
without 1C , you should use the magnificent extension -
bx_1c_import_lite.php (link to it at the end of the article), copy it to the root and then open it in the browser. By opening this link we get the ability to import files import.xml and offers.xml.

2) According to the documentation, the files import.xml and offers.xml should be copied to the uploads / 1c_catalog folder, but in fact it turned out that you need to copy these two files to the root folder 1c_catalog, after creating it.
3) Next, you should give the user (in our case, the Administrator) the ability to import (
set access rights ) through the 1c interface, shown in the following picture.

4) The next task that needs to be addressed is the
display of the catalog , this item actually we did at the very beginning of our research of the bitrix, but it is important here and now. To display the catalog, select the correct display components, the general setting idea is shown in the following figure:
those. You need to open the catalog page in the visual editor, then change the visual component of this page to the “catalog” of the available components, in the figure they are on the right. After that, dragging the component onto the page, double-clicking on it to start editing, setting all the required settings one by one.
5)
Properties . In fact, at this stage, we needed to light on the site more than one thousand properties on the product cards. And only the Article and Price glowed, although the admin panel showed that there are properties on a product and properties on the information block of the catalog. Later it turned out that the properties in the bitrix are displayed on the product page only if they set the “Mnemonic property code”. Putting a couple of hands and making sure that the billing was correct, we made attempts to find out how to set these properties through the import.xml and offers.xml files, but found nothing suitable, after which the following script was written that filled the mnemonic codes in the browser page (it’s strange that Bitrix has no such functionality out of the box)
Here is the javascript code:var elems = document.getElementsByTagName('*');
var t = 0;
for(var i=0; i<elems.length; i++)
{
var el = elems[i];
if (el.type == 'text')
{
if (el.value == »)
{
el.value = 'CATL_' + t;
t = t + 1;
}
}
}
alert(t);
Actually, this is where the whole process of filling the bitrix ends and we got what was needed, namely, a beautiful product card, with a big picture and the right price, a warehouse and a beautiful display of properties. An example of one product card is shown in the following image:

Having received the experience of the first acquaintance with Bitrix, I would like to
share my impressions about the system (from the point of view of the integrator and the data provider) :
1) Bitrix has tremendous opportunities right out of the box;
2) Initially, Bitrix is ​​a general purpose CMS, and cosmetic settings should be made after installation for use as a store;
3) Bitrix is ​​for business. A huge number of studios that work with bitrix. They can always be ordered development and advice;
4) The support of the CommerceML 2.0 format used by Bitrix during the import through 1C is the best of those with which we had to work (and today we support 17 cms), and the implementation itself is just great.
In the end, we got a happy customer with a full store and what's important - experience with bitrix. I hope the article will be useful for all integrating with the bitrix, because it describes the main points that you can not notice immediately when meeting with this product.
Links used:http://habrahabr.ru/company/bitrix/blog/131344/http://dev.1c-bitrix.ru/community/webdev/group/78/blog/1654/http://catalogloader.com