Bitrix and integration with 1C |
Bitrix and integration with 1C You have developed an online store on Bitrix. During development, you created all the necessary properties and filled the catalog with demo products. It remains only to download the real catalog from 1C — this means that there is still a lot of work ahead. We will have to ensure that all the necessary data is uploaded at all and uploaded to the right place. Otherwise, you will have to adjust the project to the data structure from 1C. The issue of integration is raised at every more or less large online store. It is often difficult for developers, not just beginners, to understand how the exchange mechanism works. Useful information is scattered on the Internet, it will be convenient to collect it in one place. Objectives of the article Briefly outline the main features of the exchange and its algorithm of operation; As such, the exchange is really set up quickly and easily, but often (almost always) the matter does not end there, since not all data is unloaded from 1C or unloaded in the wrong place (including due to modifications in 1C). What the regular exchange mechanism can do Import of the catalog of goods from 1C to the website; Integration functionality The exchange works by means of consecutive http GET/POST requests from 1C to the site, to the script /bitrix/admin/1c_exchange.php . The exchange consists of several key stages 1C authorization on the website; The process of uploading data from 1C to the site can be represented as the following scheme Data format for exchange with 1C If zip compression is enabled in the exchange settings on the site side (enabled by default), then 1C downloads one archive, otherwise all files separately. XML file format The information in the files is structured in accordance with the CommerceML2 commercial information exchange standard. Information about products is transmitted to the site in the following files import.xml - products, groups (sections of the information block), price types, warehouses, properties of goods and units of measurement; If the directory is large, for optimization purposes, descriptions are uploaded in separate “header” files. These are the same files import.xml and offers.xml , only do not contain anything other than descriptions. In this case, header files are processed only at the very beginning of the exchange. Information about orders is transmitted to the site in the following files documents.xml - documents (orders); General description of XML files You can enable the "debug mode” of the exchange — disable overwriting of files in the 1c_catalog folder. In this way, you can disable the deletion of upload files after the exchange is completed. To do this, you need to declare a constant in the file dbconn.php:
Now, instead of deleting the folder, it will be renamed, a numeric identifier will be added to it. The larger the number of a folder, the newer this folder is. It is important to remember that with debugging mode enabled, disk space is consumed very quickly. Therefore, after debugging, you should disable the log and delete all unnecessary exchange folders. What you need to exchange on the site side Requirements for 1C-Bitrix for integration with 1C In 1C, you can specify which products and sections to unload. Often in 1C, goods are stored differently from how they will be displayed on the site, so you can set up a virtual catalog on the 1C side to upload to the site: create the necessary structure of sections and spread out the goods on them. You can also set the conditions for the selection of goods (not all goods are needed on the site) for uploading to the site and properties (there are a lot of sv-v in 1C, not all are needed on the site). Types of uploads from 1C Occurs when data is uploaded to the site for the first time, or when it is manually launched. All goods are unloaded. Occurs frequently, between full, contains only changes in prices and balances. Full forced unloading The same as full unloading, only pictures of absolutely all goods are unloaded, without fail. It is usually used only when debugging the exchange. How to start integration with 1C The iblock type will be created; How to complete the integration To successfully complete the integration, when you already have a fully working project with up-to-date data, you need to ensure that the upload from 1C takes place: To an existing information block; Thus, if you first made a website, and then decided to attach an exchange with 1C to it, then you will need to get all the XML_IDS from 1C and update them on the site (write a service script for these purposes). Since on the 1C side there is often no way to change these codes (from experience with 1C programmers). An intelligent 1C user can generate a csv file with a list of sections and codes in 1C, then you need to update these codes on the site. Let's summarize the results However, if you know in advance that you have to do the integration, start by examining the upload files and test uploading to the site "as is". The sooner you understand what needs to be finalized in the exchange so that everything works as it should, the better. Soon I plan to prepare articles on debugging unloading and customization. Don't switch. Go back |
27-12-2022, 12:43 |