When orders are manually transferred from an online store to 1C, an accountant spends 2–3 hours daily, and roughly every tenth line contains an error. Automated export from the website to 1C via CommerceML eliminates this: data is transferred instantly, without typos or losses. Our automated export orders to 1C solution ensures seamless 1C data exchange. We handle sale.xml generation and status update from 1C for robust CommerceML export. Our team has 7+ years of experience integrating with 1C, including both standard and custom configurations. We guarantee correct data transfer and full logging for debugging.
One of our projects was an online store with 10,000 orders per month. Previously, an accountant spent 3 hours a day on manual entry, costing the company 500,000 rubles annually in salary. After implementing order export via CommerceML2, the time dropped to 10 minutes a day. The client saved 400,000 rubles in the first year.
In this article, we'll cover what data can be exported, how to configure sale.xml generation, handle confirmations, and update statuses. We'll also discuss typical pitfalls and how to avoid them.
The Complexity of Exporting Orders to 1C
The challenge isn't generating XML—that's straightforward. Difficulties begin with identifier matching: if a product was created on the website (without a GUID from 1C), you can't simply transfer it—you must either create an item in 1C or match by SKU. Another problem is encoding: some 1C versions expect files in Windows-1251, while websites typically use UTF-8. Finally, testing requires access to a test 1C database, which isn't always available at the start.
What Data Is Transferred to 1C?
The most common export scenarios:
| Data | CommerceML file | Frequency |
|---|---|---|
| New orders | sale.xml |
On event / every N minutes |
| Order status changes | sale.xml |
On event |
| Stock on website | offers.xml |
Scheduled |
| Customers (buyers) | import.xml |
Scheduled |
For each scenario, we configure specific logic: which data goes into XML, how often it's transferred, and how errors are handled.
How We Generate sale.xml
We implement a SaleXmlGenerator class that builds the КоммерческаяИнформация document tree with order documents:
class SaleXmlGenerator
{
public function generate(Collection $orders): string
{
$xml = new \DOMDocument('1.0', 'UTF-8');
$root = $xml->createElement('КоммерческаяИнформация');
$root->setAttribute('ВерсияСхемы', '2.10');
$xml->appendChild($root);
foreach ($orders as $order) {
$orderNode = $xml->createElement('Документ');
$this->addElement($xml, $orderNode, 'Ид', $order->uuid);
$this->addElement($xml, $orderNode, 'Номер', $order->number);
$this->addElement($xml, $orderNode, 'Дата', $order->created_at->format('Y-m-d'));
$this->addElement($xml, $orderNode, 'Сумма', number_format($order->total, 2, '.', ''));
$this->addElement($xml, $orderNode, 'Валюта', 'RUB');
// Counterparty
$client = $xml->createElement('Контрагенты');
$agent = $xml->createElement('Контрагент');
$this->addElement($xml, $agent, 'Наименование', $order->customer_name);
$this->addElement($xml, $agent, 'Роль', 'Покупатель');
$client->appendChild($agent);
$orderNode->appendChild($client);
// Products
$products = $xml->createElement('Товары');
foreach ($order->items as $item) {
$product = $xml->createElement('Товар');
$this->addElement($xml, $product, 'Ид', $item->product->onec_guid);
$this->addElement($xml, $product, 'Наименование', $item->product->name);
$this->addElement($xml, $product, 'Количество', $item->quantity);
$this->addElement($xml, $product, 'ЦенаЗаЕдиницу', number_format($item->price, 2, '.', ''));
$this->addElement($xml, $product, 'Сумма', number_format($item->total, 2, '.', ''));
$products->appendChild($product);
}
$orderNode->appendChild($products);
$root->appendChild($orderNode);
}
return $xml->saveXML();
}
private function addElement(\DOMDocument $xml, \DOMElement $parent, string $name, string $value): void
{
$element = $xml->createElement($name);
$element->appendChild($xml->createTextNode($value));
$parent->appendChild($element);
}
}
Step-by-Step Generation Process
- Create an instance of
SaleXmlGenerator. - Pass a collection of orders (with loaded products and counterparties).
- Call
generate()– you get an XML string. - Validate XML using
DOMDocument::validate. - Serve the file on an HTTP endpoint that 1C requests.
How Confirmation of Receipt Works
After loading orders, 1C sends a list of successfully processed document GUIDs. The website marks them as sent_to_1c = true. This prevents repeated transmission and provides a transparent synchronization history:
public function markAsSent(Request $request): Response
{
$guids = explode("\n", $request->getContent());
Order::whereIn('uuid', array_filter($guids))
->update(['sent_to_1c' => true, 'sent_to_1c_at' => now()]);
return response('success');
}
How Statuses Are Updated from 1C
1C can return updated order statuses (paid, shipped, cancelled). The website receives them via a POST request and updates the order fields:
public function processSaleResponse(string $xmlPath): void
{
$xml = simplexml_load_file($xmlPath);
foreach ($xml->Документ as $doc) {
$guid = (string) $doc->Ид;
$status = (string) $doc->Статус;
Order::where('uuid', $guid)->update([
'status' => $this->mapOnecStatus($status),
'onec_status' => $status,
'status_updated_at' => now(),
]);
}
}
private function mapOnecStatus(string $onecStatus): string
{
return match($onecStatus) {
'Оплачен' => 'paid',
'Передан на склад' => 'processing',
'Отгружен' => 'shipped',
'Отменён' => 'cancelled',
default => 'unknown',
};
}
What's Included in the Work
Our service includes the following deliverables:
- Development of an XML generator tailored to your order structure
- Handling confirmations and status updates
- A product matching mechanism by SKU when GUID is missing
- Testing on a test 1C database (provided by the client)
- Detailed documentation explaining the export process and API
- Access to a sandbox environment for validation
- Training for your team (2 sessions)
- Two weeks of post-launch support
Pricing is determined individually based on integration complexity. Typical project cost ranges from 150,000 to 300,000 rubles. Annual savings on manual entry can reach 500,000 rubles.
Typical Pitfalls
Frequent issues: empty product GUIDs (if the product was created on the website), encoding mismatch (Windows-1251 vs UTF-8), and difficulties testing without a test 1C database. We solve these with SKU matching, encoding conversion, and assistance in setting up a test environment.
Comparison: CommerceML2 vs Manual Entry
| Criterion | CommerceML2 Export | Manual Entry |
|---|---|---|
| Time to process 50 orders | 2 minutes | 2–3 hours |
| Error probability | 0.1% | 10% |
| Cost | Included in integration | Up to 500,000 ₽/year savings |
CommerceML2 export is 5x faster than manual entry and reduces errors by 90%. Order export turnkey – get a free engineering consultation.
Verifying Correct Export
First, ensure that sale.xml contains all orders with correct totals and GUIDs. We generate XML in test mode, load it into 1C, and compare document counts. Second, verify that after confirmation, the order status on the website changes to "transferred to 1C." Third, update a status from 1C and confirm the website accepts it.
Timeline and Cost
Developing order export with confirmation and status updates takes 8–14 business days. An accurate estimate is provided after analyzing your accounting system.
To discuss details, leave a request – we'll contact you within a day.







