Setting up barcode export from 1C to 1C-Bitrix

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Configuring Barcode Export from 1C to 1C-Bitrix

Barcodes on a site are not merely cosmetic additions to the product card. They are the key to fast search (a buyer scans the packaging), integration with marketplaces (EAN is required), and automatic identification systems in B2B. In 1C, barcodes are stored in a separate register, and transferring them to Bitrix is a separate task not covered by standard CommerceML out of the box.

How Barcodes Are Stored in 1C

In 1C:UT 11 and other configurations, barcodes are stored in the information register ProductBarcodes. Structure:

  • Nomenclature — reference to the directory
  • Characteristic — if the barcode is linked to a specific characteristic (SKU)
  • Unit of measure — EAN for piece, box, pallet may differ
  • Barcode — string (EAN-8, EAN-13, Code128, QR, Datamatrix)
  • Barcode type — EAN13, EAN8, Code128, etc.

One product can have multiple barcodes:

  • EAN-13 for a unit (piece)
  • EAN-13 for a package (6 pieces)
  • Code128 for a pallet
  • Additional supplier barcode

CommerceML and Barcodes: Standard Method

CommerceML 2.08 has a Barcode tag — but its support in the standard Bitrix exchange module is limited. The barcode is transferred as an additional attribute or via a special tag inside <Product>:

<Product>
  <Id>product-guid</Id>
  <Name>Sample Product</Name>
  <Barcode>4607025491117</Barcode>
</Product>

Some versions of the Bitrix exchange module read this tag and write it to the infoblock property CML2_BAR_CODE. Check: if the CML2_BAR_CODE property exists after the first import — the barcode is being transferred in the standard way.

If not — an import event handler is needed.

Custom Handler for Multiple Barcodes

For transferring multiple barcodes (per unit of measure), the standard tag is insufficient. Use AdditionalAttributes:

<AdditionalAttributes>
  <AttributeValue>
    <Name>BarcodePiece</Name>
    <Value>4607025491117</Value>
  </AttributeValue>
  <AttributeValue>
    <Name>BarcodeBox</Name>
    <Value>4607025491124</Value>
  </AttributeValue>
</AdditionalAttributes>

In Bitrix, create infoblock properties BARCODE_UNIT and BARCODE_BOX of type "String". The OnIBlockCMLImport2ElementAdd event handler populates these properties:

AddEventHandler('catalog', 'OnIBlockCMLImport2ElementAdd',
    'fillBarcodeProperties');

function fillBarcodeProperties(&$arFields, &$arProps, $arXML) {
    if (isset($arXML['BARCODE_UNIT'])) {
        $arProps['BARCODE_UNIT'] = $arXML['BARCODE_UNIT'];
    }
    if (isset($arXML['BARCODE_BOX'])) {
        $arProps['BARCODE_BOX'] = $arXML['BARCODE_BOX'];
    }
}

Barcodes for Trade Offers (SKUs)

If a barcode is linked to a characteristic (e.g., different EANs for a red and blue T-shirt), it must be transferred at the offer level, not the product level. In the offer XML:

<Offer>
  <Id>product-guid#characteristic-guid</Id>
  <Barcode>4607025491131</Barcode>
</Offer>

In the Bitrix offer infoblock, create a BARCODE property and populate it using a similar handler, but for the OnIBlockCMLImport2OfferAdd event.

Barcode Search on the Site

After populating the BARCODE property, barcode search is implemented via the standard Bitrix search component or custom code:

$result = CIBlockElement::GetList(
    [],
    [
        'IBLOCK_ID' => CATALOG_IBLOCK_ID,
        'PROPERTY_BARCODE' => $scannedCode,
    ],
    false,
    false,
    ['ID', 'NAME', 'DETAIL_PAGE_URL']
);

For mobile sites — integrate a barcode scanning library via camera (ZXing or QuaggaJS). The user scans the package barcode — the site instantly opens the product card.

Case Study: B2B Platform with EDI

A food manufacturer with EDI integration: retailers require EAN-13 on every item in the price list. Barcodes are maintained in 1C, but historically were not exported to the B2B portal.

Task: add EAN-13 to every item in the B2B portal catalog so that retailers can copy them when loading into their own systems.

A one-time export of all barcodes from 1C was performed (external processing → CSV), then loaded into Bitrix via a mass update script for the BARCODE property. Time: 4 hours for 12,000 items.

Subsequent synchronization during exchange was configured: new products arrive with a barcode in AdditionalAttributes, the handler populates the property. Changes to an existing item's barcode — via the same mechanism.