1C Integration via CommerceML with Website
CommerceML is a standard for exchanging commercial data between 1C and trading systems. Developed by 1C company, widely supported by Russian CMS (1C-Bitrix, OpenCart, WordPress + WooCommerce). For custom websites — CommerceML parser implementation is needed.
CommerceML Format
CommerceML is an XML format with several file types:
-
import.xml— product catalog (nomenclature, groups, properties) -
offers.xml— offers (prices, stock, characteristics) -
orders.xml— orders (export from CMS to 1C) -
import.xmlin response from 1C — order status updates
import.xml Structure
<?xml version="1.0" encoding="UTF-8"?>
<CommercialInformation SchemaVersion="2.05">
<Catalog ContainsOnlyChanges="false">
<Goods>
<Good>
<Id>550e8400-e29b-41d4-a716-446655440001</Id>
<Name>Men's Blue T-shirt</Name>
<Groups><Id>category-001</Id></Groups>
<TaxRate>VAT20</TaxRate>
<Picture>images/tshirt.jpg</Picture>
<PropertyValues>
<PropertyValue>
<Id>prop-color</Id>
<Value>Blue</Value>
</PropertyValue>
</PropertyValues>
</Good>
</Goods>
</Catalog>
</CommercialInformation>
offers.xml Structure
<OfferPackage>
<Offers>
<Offer>
<Id>550e8400-e29b-41d4-a716-446655440001#size-XL</Id>
<Name>Men's Blue T-shirt XL</Name>
<Prices>
<Price>
<PriceTypeId>retail</PriceTypeId>
<PricePerUnit>1500.00</PricePerUnit>
<Currency>RUB</Currency>
</Price>
</Prices>
<Quantity>25</Quantity>
</Offer>
</Offers>
</OfferPackage>
Exchange Protocol
1C initiates exchange session through HTTP requests to CMS by specific protocol:
GET /exchange.php?type=catalog&mode=checkauth
→ Authorization
GET /exchange.php?type=catalog&mode=init
→ Initialization (buffer size, zip support)
POST /exchange.php?type=catalog&mode=file&filename=import.xml
→ File upload (may be split for large files)
GET /exchange.php?type=catalog&mode=import&filename=import.xml
→ Processing start
PHP Handler Implementation
class CommerceML
{
public function handle(Request $request): Response
{
$mode = $request->query('mode');
$type = $request->query('type');
return match($mode) {
'checkauth' => $this->checkAuth(),
'init' => $this->init(),
'file' => $this->saveFile($request),
'import' => $this->processImport($request->query('filename')),
'query' => $this->exportOrders(), // export orders to 1C
'success' => $this->markOrdersExported(),
default => response('failure', 400)
};
}
protected function processImport(string $filename): Response
{
$xml = simplexml_load_file(storage_path("cms-exchange/{$filename}"));
// Parse and save products to database
dispatch(new ProcessCommerceMLImport($xml));
return response('success');
}
}
Incremental Updates
After initial full synchronization, subsequent exchanges can be incremental: ContainsOnlyChanges="true". This significantly speeds up synchronization.
Characteristics and Variations
Products with variations (size, color) in CommerceML are represented as single nomenclature with multiple offers. Each offer has unique Id like {product-guid}#{characteristic-guid}. Need to correctly map this to product variations in website database.
Development Timeline: 2–4 weeks for implementing CommerceML parser and bidirectional exchange.







