In April 2014, 1C-Bitrix introduced a new version 14.5. Among the many innovations in it, it became possible to exchange data with 1C in real time. The new system does not require the installation of a separate server and special settings. Consider the "pitfalls" that a developer may encounter when working with it.
We install the addition of the exchange module with 1C from the Bitrix website. We will not dwell on this point in detail, since the instructions for installing and configuring the module are in the downloaded archive.
After installation and configuration, we try to start data exchange. We immediately encounter the first difficulty: an error message appears
It can be seen from the error that the cause of the problem is the lack of a limit on the maximum number of characters in the Nomenclature.Description field. This problem is solved as follows:
The reason for this error is in the difference between the configurations 1C UT 11.1.4.10 and 1C UT 11.1.4.13
We solve this problem like this:
In 1C, in the Configurator mode, we find the module General - General modules - B_ExchangeSiteServer and change the line
THEN Remains.In StockRemainder - Remains for THEN Remains.AvailableRemain - Remains.In ReserveFrom WarehouseRemain - Remains.InReserveOn OrderRemain
We update the database configuration, launch 1C and perform the exchange.
It would seem that everything is fine, but the statuses of orders on the site are not updated. Those. Bitrix support answered this problem:
There is an error in Bitrix that does not allow changing the order data by uploading.
The bug has been fixed, but an update with a fix hasn't been released yet.
Replace the following line in /bitrix/modules/sale/general/order_loader.php file:
if($arOrder["VERSION_1C"] != $orderInfo["VERSION_1C"]) // skip update if the same version
on the
if($arOrder["VERSION_1C"] != $orderInfo["VERSION_1C"] || (strlen($orderInfo["VERSION_1C"]) and the string
if(is_array($val))
on the
if(is_array($val) && is_array($val["#"]))
This should fix the issue.
We start the exchange again. Everything is fine - there are no errors, orders and products are updated.
After all configuration problems have been resolved, orders and products can be updated directly from 1C in real time, which will allow site visitors to always receive up-to-date information about the price and availability of goods, and HORSEPOWER employees to work more productively with customers.
You have developed an online store on Bitrix. During development, you created all the necessary properties and populated 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 unloaded at all and unloaded 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 scattered over the Internet, it will be convenient to collect it in one place.
Purpose of the article
Bitrix has built-in functionality for exchanging with 1C, thanks to which any exchange should be configured in a couple of clicks.
However, for this, 1C must be a “clean” standard configuration. In fact, every first 1C is “atypical”, that is, modified in one way or another.
As such, the exchange is really set up quickly and easily, but often (almost always) this is not the end of the matter, since not all data is uploaded from 1C or it is not uploaded there (including due to modifications in 1C).
What can a standard exchange mechanism do?
Product information is transmitted to the site in the following files
Files import.xml And offers.xml contain descriptions of properties, types of prices, and other information that applies equally to all goods / TP.
If the directory is large, for optimization purposes, the descriptions are uploaded in separate “header” files. These are the same import.xml and offers.xml files, only they contain nothing but 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
To the folder /upload/1c_catalog/. Before each exchange, this folder is cleared. That is, this folder always contains the files of the last exchange.
Can be turned on " exchange debug mode- disable overwriting files in the 1c_catalog folder. Thus, you can disable the deletion of upload files after the exchange is completed.
To do this, you need to declare a constant in the dbconn.php file:
// Enables "debug mode" for exchange with 1C, // disables overwriting of files in the 1c_catalog folder // So that all files would be saved after unloading define("BX_CATALOG_IMPORT_1C_PRESERVE", true);
Now, instead of deleting, the folder will be renamed, a numeric identifier will be added to it.
The higher the number for a folder, the newer the folder.
However, the newest folder will always be without numbers, and only with the next exchange will it be renamed.
It is important to remember that with the debug mode enabled, disk space is consumed very quickly. Therefore, after debugging, you should disable the log and delete all unnecessary exchange folders.
What to do if the directory structure in 1C does not match the structure on the site?
In 1C, you can specify which products and sections to upload.
Often, in 1C, goods are not stored in the way they will be displayed on the site, so you can set up a virtual catalog on the 1C side for uploading to the site: create the desired section structure and sort the goods into them.
You can also set the conditions for selecting goods (not all goods are needed on the site) for uploading to the site and properties (there are many sv-in in 1C, not all are needed on the site).
Full unloading
Occurs when data is uploaded to the site for the first time, or when manually started.
Brief unloading
Occurs often, between full, contains only changes in prices and balances.
Full forced unloading
The same as full unloading, only images of absolutely all goods are unloaded, without fail.
Usually used only when debugging an exchange.
If you are making a new site and planning to integrate with 1C in the future, then you should first install Bitrix and make a test exchange. Here's what it will give:
All this together will help you understand what data you already have and where to look for it. It will immediately be clear what is missing, and what was not unloaded at all as we would like.
Compare the data structures on the site with the structure in 1C - here the main objective 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 unloading from 1C occurs:
All these tasks are solved by setting the same identifiers (XML_ID), that is, you must match all external codes on the site with external codes from 1C.
To implement integration with 1C, you do not need to buy any additional modules or configurations. Buying "1C: Trade Management" and "1C-Bitrix: Site Management" you immediately get the necessary functionality.
You can freely modify the desired integration functionality by downloading and installing a free module for 1C: Trade Management.
The product provides for the automation of a wide range of tasks facing the site of an online store, as well as a number of different business models for the operation of functional blocks. Modules for integrating a site with 1C contain a large number of settings, which almost always allows you to flexibly adapt to your company's business processes.
To ensure integration with 1C, you do not need to be a specialist in programming or web technologies. The provided settings are simple and understandable for a user with general computer skills and basic knowledge of 1C and 1C-Bitrix products.
The functionality of integration with 1C can work unnoticed by employees, freeing them from routine operations.
You can set up automatic two-way data exchange according to a schedule, and the system will perform the specified operations at the specified time intervals, for example, at night, which is very convenient. It is possible for administrators to receive reports on the results of the exchange, including logs with errors, if any.
Real-time exchange with 1C is a technology of continuous two-way communication between 1C-Bitrix: Site Management and 1C. The system provides real-time data exchange (balances, prices, orders, etc.). This does not require the installation of a separate server and special settings. The system works stably on almost any server.
You can get information in real time:
Site security threats cannot threaten the security of your data in 1C.
The website of the online store works on a remote hosting and does not have access to your 1C system and its database.
Only 1C stores all necessary information to work with the site: server address and data for authentication. For an online store website, a request from 1C is a typical request from a user that needs to be processed in accordance with his rights.
Violation of 1C security also does not threaten the security of the site, since the exchange is performed from the rights of a user who has rather limited rights (only work with goods and orders), and in principle cannot cause any significant harm to the site.
Your online store can work with a large number of visitors, at the same time many of them can work with a product catalog, placing orders for goods.
The site can keep the load without affecting the performance of 1C.
The load on 1C depends only on the data exchange settings that the administrator will perform: the volume of the product catalog, the presence of images and attributes, and how often the exchange should take place. The most resource-intensive procedure for 1C is the preparation of a large number of stock items for unloading. But due to the control of changed positions, during each exchange session with the site, only those goods will be unloaded, the data for which have been changed. Often these are not units or dozens of goods, so such a load is almost imperceptible.
The integration is based on the use of an open documented commercial information exchange format CommerceML .
In 2010, at the very beginning of our company's journey, we were engaged in support software based on 1C:Enterprise in various organizations. These were standard solutions, as well as individual, completely redesigned for the needs of these organizations. During this time, we have accumulated the very experience that we are ready to use now for the needs of your sites. We will set up the uploading of goods to the site, prepare the site user base from your counterparties in 1C, set up the exchange of documents in real time. We have experience in performing work both in the field retail, and in the b2b sector.
Products "1C:Enterprise 8.2" and "1C-Bitrix: Site Management" come with standard interaction procedures built into the systems and support for bidirectional data exchange with 1C:Enterprise, forming a turnkey integrated solution for trade automation, including the creation of corporate websites and organization of sales on the Internet.
The interaction of 1C and 1C-Bitrix products is implemented on the basis of bidirectional data exchange procedures. Data is exchanged using the XML-based, open Business Information Exchange Standard, CommerceML 2.0.
You can get information in real time:
And 1C: Enterprise Trade Management, edition 11.1 (11.1.2.31).
The point of relevance of the article is May 2015.
Pay attention to it.
A lot of things, having mastered once, we do almost automatically.
However, not everyone who knows how to drive a car can become a driving instructor.
It's one thing to do it yourself, quite another to tell someone else how to do it. Many of you are familiar with this old anecdote.
- Honey, where's the tea? I just can not find .... - Oh, how helpless you are! Tea in the first aid kit, in a can of cocoa, on which the sticker "SALT".
That is why most of the instructions for integrating 1C and Bitrix do not focus on the moments that a beginner can spend from several hours to several days of his time.
I will try to close this question as much as possible in terms of a quick start.
(I won’t be mistaken if I say that many people want to see how 1C Trade Management works in conjunction with an online store).
Many thanks to the Bitrix developers for the virtual machine. With it, installing the system for testing began to take minutes.
Further - refer to the forums, gurus, kuru, etc.
Let's get started.
What to download:
We start the virtual machine in the player.
We install add-ons in the 1C template directory.
From the templates, we create the database Trade Management Demo, edition 11.1 (11.1.2.31). Enable change option in configurator
, and integrate the add-on module from Bitrix.
This process is fully described in the documentation file that comes with the module. I quote verbatim:
10. Compare and merge configurations (the "Run" button).
Note.
It is recommended to run 1C with the parameter " Startupdating the InfoBase", in order for 1C to fill in all service data in 1C. Launching with a parameter can be launched both through the command line and from the configurator.
In order to run from the command line, you need to specify the following parameters:
"<Адрес к 1 c.v.8. exe>" ENTERPRISE (/ For /Sdepending on the type of base) ""<Адрес к базе> " / N"<Логин>" / P"<Пароль>" /C Run InfoBase Update
In order to run from the configurator, you need to go: Tools -> Options. On the "Launch 1C: Enterprise" tab, you need to specify the launch parameter.
At the same time, it is better to set the launch mode to "Thick client managed application"
While we were working with 1C, a virtual machine arrived in time.
Downloading the distribution kit "Site Management" Business Demo
Selecting and setting up a store.
We leave all settings as default. If there is a desire to set up a marathon - enter your data immediately and uncheck the unused checkboxes (payment and delivery types)
In 1C we set up a connection with the site. Checking that the site is available.
Note.
We make archives.
1C - by means of 1C, and the site - by means of a virtual machine (if you make an archive through the site's admin panel, it will disappear during the first exchange with 1C).
Don't forget to remove the startup parameter "RunUpdateInfobase" it is no longer needed.
A fair desire is to download the nomenclature from the site.
See how descriptions, properties, etc. are arranged. We create a type and a group of the item "Clothes" for this
The first problem is that the download fails.
We get the error: "Failed to download data from the server. Server response: failure Export initialization failed.
Because by default, no user group has the right to do so.
Note.
You need to go to the administrative part of the site in the section Store - Integration with 1C - Catalog export. Select at least the Administrators group and save the changes.
After that, the download of goods from the site will take place.
In addition to the nomenclature with all the properties and characteristics, the BASE price will be loaded (remember this name - it will come in handy for us) and the price setting document
We can restore 1C from the archive, for the purity of the further experiment, we can not restore it.
Let's move on to uploading the nomenclature to the Bitrix website from 1C.
To begin with - a standard exchange 1C.
Go to the tab Unloading goods.
Note.
If you make an exchange now, the site will not change at all. The entire nomenclature will be uploaded to a new infoblock, which is not visible in the user part of the site.
In order to correctly get into the already configured information block of the shopping catalog (we call it Clothing), you need to correctly fill in the catalog identifier. How to recognize him?
In the administrative part of the site - go to the settings in the infoblocks
And check the box " Show download code from external sources"
After that, for the Clothing Information block, we will see the external code "clothes_s1"
It can be corrected here or added to 1C.
Next, we proceed to setting up the selection in 1C
Be sure to create and select an Agreement
As you can see, there are two conditions: Available to external users and Partner segment - empty
Note.
In fact, there are three more: It should be called BASE. If you miss this moment, the nomenclature on the site will be replaced, but all products will not be available for order. They won't have quantities or prices.
The rest of the settings in the agreement - can be "to taste". Including the price (many are worried about this).
As well as selection settings.
Note.
After all the settings - we translate the exchange mode into the state - upload to a directory on the disk.
And we make an exchange. This will give us the opportunity to see what is actually being unloaded, and 1C - to check the possibility of writing to the directory.
After that, we switch to the exchange mode with the site directly.
We exchange with the site of the store.
The exchange went through - the nomenclature, prices, quantity, pictures - everything is in place.
Let's move on to the exchange module from Bitrix.
There are a lot more settings here. But the main ones must be filled in the same way as in the previous case.
We exchange and see - the goods are not available.
If you dig deeper, the prices didn't load.
Note.
To configure the exchange of the Bitrix module, you need to correctly enter the internal price code of the site.
Remember, we agreed that the first exchange would not go directly to the site, but to a directory on the disk.
We are looking for the file prices_..
We open it in any text editor and look for the IdTypePrice tag - this is the external price code of the site.
On the site in the section Shop - Price types - edit the base price. We write down the correct external code.
After that, the site of the store takes on the correct form.
Note.
If we want to return to the standard exchange, it will not work. It is necessary on the site in the Settings section - PHP command line - execute two lines of code
COption::SetOptionString("catalog", "DEFAULT_SKIP_SOURCE_CHECK", "Y") ;
COption::SetOptionString("sale", "secure_1c_exchange", "N") ;
After that, you can exchange with the site both the Bitrix exchange module and the standard configuration exchange.
And also move on to the exchange of orders and many other interesting things in conjunction with 1C: Enterprise - 1C Bitrix.