Setting up the upload of product images 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

Setting up product image export from 1C to 1C-Bitrix

Images are transmitted from 1C to Bitrix as part of standard CommerceML exchange. In import.xml, for each product a <Картинка> block contains relative path to image file. Files are transmitted separately — loaded to server before sending XML or in same exchange session.

How image transmission works

In CommerceML protocol, images are exported in two stages:

  1. File upload. Via POST /bitrix/admin/1c_exchange.php?type=catalog&mode=file 1C uploads images to folder /bitrix/catalog_export/ (or customizable exchange folder).
  2. XML upload. import.xml contains image links: <Картинка>images/photo1.jpg</Картинка>. When parsing XML, Bitrix finds file by path and links to infoblock element.

In infoblock image goes to PREVIEW_PICTURE (preview) or DETAIL_PICTURE (detail). Additional images — to "File" type property or via \Bitrix\Iblock\PropertyTable if using multiple photos.

Configuration in 1C

In "Export to Website" processor (1C:UT, 1C:Retail etc.) must be enabled parameter "Export pictures". Without this flag XML is formed without <Картинка> blocks, and images not transmitted.

Important: 1C exports images only for goods that changed (in incremental exchange). If image added to product first time — it will be in next exchange. If image changed but other product data didn't — 1C may not include product in export. Solution: when updating image in 1C, manually "touch" the record (change any field and save).

Multiple images

By CommerceML standard for multiple images you can transmit multiple <Картинка> tags. Bitrix by default processes first image as DETAIL_PICTURE, rest are lost — if "Additional images" property in infoblock not configured.

To support image gallery:

  1. In infoblock create "File" type property, multiple, for example with code MORE_PHOTO.
  2. In OnIBlockChange event handler (or post-processing agent) additional images from XML written to this property.
  3. In template of catalog.element component output gallery via $arResult["PROPERTIES"]["MORE_PHOTO"].

Re-export of images

During full exchange, images are re-loaded to server and re-linked to elements. This means on each exchange files overwritten. If images were edited on site side (resize, watermark) — they will overwritten with originals from 1C.

Solution: if custom processing needed — apply it via agent after exchange, don't manually edit files.

Problems with file name encoding

If file names contain Cyrillic — possible problems when transmitting via HTTP. 1C sometimes transmits file names in UTF-8, sometimes in Windows-1251. In Bitrix handler check file name encoding and if needed transliterate when saving.

Image sizes and performance

With large catalog (thousands of products with multiple images) loading images during exchange can take significant time. Recommendations:

  • Enable image compression on 1C side before export (or use external resize processing)
  • On Bitrix side — resize via CFile::ResizeImageGet() with caching, not on each access
  • Store original files separate from resized previews