📜 ⬆️ ⬇️

How we developed the integration of an online store with 1C: Enterprise and why it became popular. Part 3

In the final part of the story about our implementation of the integration of the 1C: Bitrix online store with the 1C: Trade management system, I would like to talk about solving a business problem of exchanging data on customer orders.

image

Let me remind the essence of the previous topics on this topic:

In the first post, we talked about how the tasks faced by the owners of online stores were analyzed, the concept of data exchange was chosen and the protocol of exchange between 1C and the online store was developed.
')
The second demonstrated a specific solution to the business problem of uploading to the site a database of goods from 1C, including the choice of nomenclature for uploading, data processing settings on the site side, as well as some technical solutions to ensure the stability of upload operation on large data volumes.

Well, now in our online store we have a catalog of goods, unloaded from 1C, and now the goods need to be sold to the client from the point of view of the order processing process itself.

After adding the product to the cart, the customer went to the order form to fill out the details.



Specified contact information, payment method and chose the delivery option. The order is assigned a specific number, it is saved in the system, a personal account is available to the client to view the order history.



What to do now? Of course, "process the order." But where to process it - on the website or in 1C? After all, we have integration. You must select a business model for processing orders, and there are generally three such models:

Order processing directly on the site

The capabilities of the administrative part of the CMS for order management are used. Objectively speaking, such opportunities in the 1C-Bitrix system: Site management is very wide and sufficient for most stores:
- search for orders by filter
- view order data,
- order editing (contact details, order composition,),
- unlimited number of order statuses and different user permissions to work with each of the statuses
- printing documents and much more



Usually such a model is chosen by those for whom the store is the only or almost the main source of sales. All at once in one system, customers immediately see changes in their orders, receive notifications.

If there is 1C, then when the order is already processed, the money is received, the order is delivered - they want to unload the order in 1C, for reporting.

Order processing in 1C

Some clients, even after seeing an abundance of possibilities for processing orders in the admin panel of the site, insist that all processing be carried out in the 1C system . In other words, customers want the order created on the site to immediately appear in 1C for further processing.

Usually these are companies for which an online store is just one of the sales channels, along with, for example, retail, or dealer sales. In this case, such a model is solely due to the need to ensure all processing in a single place, in a single order processing center.

In this case, all processing is carried out in a single system, which stores the nomenclature, inventory, reserves, and so on. This is definitely also very convenient.

For such a business model, the key requirement for the integration of 1C with an online store is the efficiency and completeness of obtaining data on the order from the site . Additional complexity is here: in order for clients to track the order execution process in their personal account, it is necessary for 1C to inform the site about the changes in orders that occur in it during work.

Mixed model

Sometimes it is required to organize various combined schemes, when part of operations are performed on the site, and part in 1C. You can perform partial processing of orders on the site (for example, receiving an order and clarifying it with the buyer), and when the order goes into the specified status, transfer it to 1C.

Implementation of business models in the integration of 1C and 1C-Bitrix

As you can see, the business task of integrating orders at first glance is simple, but it has a number of nuances. Now let's take a look at our integration implementation functionality.

Settings on the site side

According to the exchange protocol , 1C regularly sends requests to the site and receives the resulting response in CommerceML format. In the administrative part of the 1C-Bitrix system there is a set of settings that affect the process of forming this answer.

The first part of the integration settings for orders is located in the general settings for integration with 1C, on the Orders tab (the Catalog tab was covered in the previous section, it concerned the import of goods).



Here are indicated:
further parameters affecting the business process:
In essence, with these three parameters, the customer chooses the model of the shop. Or orders, immediately from the first status fall into 1C, and then all their processing is done in 1C. Or all processing is done in the store, and the unloading takes place on the final status. Or some mixed option is chosen.
Unloading only paid or only orders with permitted shipment - severely restricts the unloading of orders under the flags "paid" and "shipped", regardless of status. After all, statuses are a custom thing, and they may not be associated with these flags.

Settings on the side of 1C

The site prepared a CommerceML file with data on the order, including data of the counterparty, a list of commodity items and service information, and gave 1C in response to the request. Now you need to configure how this order will now be processed and saved in 1C.

The process of saving an order includes several steps:
In order to enable order integration, you need to tick the “Basic Settings” tab and a specialized settings tab will appear.



Let me remind you that on the tab “Basic Settings” you can configure the 1C access interval to the site. For example, orders can be taken every 5 minutes.

On the tab exchange orders are configured:



1) A way to identify counterparties.

This setting controls the search engine counterparty from the site among the existing counterparties in 1C. Today, there are 2 ways of identification to choose from - by name (usually for individuals) and by combination of INN + KPP for legal entities. In the near future, we plan to add another identification option - by the site user ID (the name for large stores can still be repeated).
If the counterparty could not be found, a new one is created.

2) Parameters for creating new items of the “Nomenclature” reference book

This setting is needed for cases when the product is in the order, but it is not in 1C. Or can not find. In this case, to ensure the logical integrity of the data in 1C, it is necessary that the goods exist - and in this case, 1C simply imports it into its nomenclature directory.

On the tab "Advanced" specify the parameters of the documents in 1C, including the cancellation of orders, and the important setting - "Compliance with the status of orders":



As well as on the site side, 1C can also set the status of the “Customer Order” document according to the order status on the site. For example, if the order on the site is confirmed, then in 1C it automatically receives the status “Agreed”. It's comfortable.

Export orders from 1C to the site

The exchange of orders in contrast to the exchange of goods in the integration scheme is two-way . Not only the site gives 1C data on incoming orders, but 1C also informs the site about those orders that were previously unloaded and were changed in 1C. This is usually an example of an order processing model in 1C, when payment and shipping are not performed on the site.

The manager in 1C can call the client and during the communication change the list of positions, price, make a discount, change the parameters of delivery or payment. If the site is not informed about these changes, then the client will have outdated information on his orders in his personal account.

The scheme of work 1C such. If the orders downloaded from the site have been changed, then the 1C exchange session will upload these changes to the site (also in CommerceML format), and the site will accept them and update the order information.

Another case of changing an order in 1C is a change in its status. The accountant received payment and formed a payment order, the order has now become paid and we also need to change the status on the site. In the settings of the online store module there are 2 more parameters on the site:



that is, the site automatically changes the status of the order when receiving data from 1C on payment and (or) shipment. And to change the status, you can “hang up” the handler, send a message to the client (by email or sms).

Total: integration of the task of informing the buyer, despite the fact that order processing occurs outside the site.

Additional integration options



All the integration settings with 1C from the site on 1C-Bitrix, which we have considered, are only the default default settings that relate to the default integration script http: // <your_site> /bitrix/admin/1c_exchange.php.

But from a technical point of view, the entire integration interface from the site consists of two components of the 1C-Bitrix system, which the developer can use to create his own arbitrary interaction interface with 1C, to refine and extend the existing functionality.

These are the components “bitrix: catalog.import.1c” and “bitrix: sale.export.1c”. They are available directly in the visual editor. You can create your own integration script with individual settings. Everything is done elementary:

1) Create a page on the site, you can directly in the visual editor (you can make a single URL for products and orders, as in the default interface, but you can also have different ones)
2) Place on the page the components of the exchange with 1C to configure the necessary parameters



In principle, using steps 1 and 2, you can configure an individual exchange interface for each 1C, which integrates with the site. For example, you have several online stores on the same engine, and each of them has its own 1C exchange. Or you have one online store, but several suppliers, each of which has one 1C. It is more logical and more correct to make for each 1C its own interface for importing goods.

But that's not all.

The components “catalog.import.1c” and “sale.export.1c” are common components of the 2.0 platform 1C-Bitrix. They can be customized using standard techniques, or they can even be taken out into their namespace and arbitrarily change their source code.

For example, you can do additional data processing before writing to the site database, bind data with other site entities, and so on.

In a word, we give the opportunity not only to create your own interface settings, different from the default ones, but also to change your interface in general.

Using this feature, you can implement the exchange with other 1C products (of course, if there is an integration mechanism on that side), or with products of other vendors.

General conclusions on integration:


Let's sum up the three posts on this topic.
  1. Implemented a ready-made integration mechanism between 1C and an online store, which allows out of the box to solve a large number of typical customer tasks for uploading a catalog and exchanging orders
  2. There is a possibility of flexible integration settings both from 1C-Bitrik: Site management, and from 1C: Trade management, to adapt to the specifics of the client’s business
  3. Opportunities for customization and refinement of the integration functionality
  4. Data is exchanged using the open XML standard CommerceML.
  5. The data exchange protocol is simplified as much as possible, uses HTTP (S) and takes into account typical hosters' restrictions on the operation of site scripts
  6. The integration architecture maximally protects 1C: Enterprise from threats from the Internet, the initiator of the exchange is always 1C, and the site only responds to requests
In general, we believe that we have achieved the goals that were set before us at the very beginning.

Yes, not everything was possible to make as convenient as possible, but work on improving integration has been going on continuously for several years and will continue.

We have very strong feedback from customers and partners. As part of the support service, there are technical experts on 1C products, which, together with the 1C-Bitrix developers, allows us to solve complex issues that are often at the junction of systems. All wishes are recorded and reasonable suggestions are surely realized.

Together with 1C, we didn’t create any kind of closed integration and data exchange architecture, but on the contrary, we tried to make it usable, open for modifications and modifications, and the prevalence of such integration among modern CMS for online stores confirms that this goal was reached!

And to read the following entries in your feed, click "Like" in the company profile , and check your tape setup.

Source: https://habr.com/ru/post/134318/


All Articles