Parsing supplier price lists for 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

Parsing Supplier Price Lists for 1C-Bitrix

A supplier's price list is an Excel file, CSV table, or PDF that arrives daily, weekly, or sometimes multiple times a day. It can contain thousands of items with prices, stock levels, and characteristics. Moving this manually into a 1C-Bitrix catalog is impossible — too slow and too many errors. The parsing task is to read the supplier's price list and update catalog data automatically.

Price List Formats and Parsing Strategies

Supplier price lists are rarely standard. Each has its own structure, columns, and encoding.

Format Parsing Notes
Excel (.xlsx, .xls) PhpSpreadsheet for reading; find header row, skip ads and decorative blocks
CSV fgetcsv(), account for delimiter (; or ,) and encoding (Windows-1251 for Russian suppliers)
ODS (OpenDocument) PhpSpreadsheet supports it
PDF Most difficult: pdftotext or OCR service API; structure is lost

Main Excel problem: each supplier makes their own format. One has article in column A, another in E. One has three header rows, another has one. The parser must be configurable: column mapping is set for each supplier.

Import System Architecture

Store supplier settings in a separate structure (infoblock or custom table):

Supplier:
  - Name
  - Price retrieval method (FTP / email / HTTP / Telegram)
  - File format
  - Column mapping: {article: A, name: B, price: C, stock: D}
  - Transformation rules: {price: multiply by 1.3, name: prefix "Brand X"}
  - Update schedule
  - Price type in Bitrix (price list ID)

Column mapping is represented as an array passed to a universal parser class. This lets you add new suppliers without code changes.

Getting the Price List

File retrieval methods:

  • FTP/SFTP — supplier uploads file to server, script downloads on schedule. Use ftp_connect() or phpseclib library.
  • HTTP linkfile_get_contents() or curl. Some suppliers require auth — HTTP Basic or cookie session.
  • Email — email with attachment. Parser connects to IMAP mailbox (imap_open()), searches for supplier emails, downloads attachment.
  • Telegram bot — rare but happens: get file via Telegram Bot API.

Updating Prices and Stock in 1C-Bitrix

After parsing the file, data must be entered into the catalog. Key identifier is article (ARTICLE or XML_ID in infoblock).

Update price:

\Bitrix\Catalog\PriceTable::update($priceId, [
    'PRICE' => $newPrice,
    'CURRENCY' => 'RUB',
]);
// or bulk via CCatalogProduct::SetOptimalPrice()

Update stock:

\Bitrix\Catalog\StoreProductTable::update($storeProductId, [
    'AMOUNT' => $newAmount,
]);
// or if not using warehouses:
CCatalogProduct::Update($productId, ['QUANTITY' => $newQty]);

Find product by article:

$result = \Bitrix\Iblock\ElementTable::getList([
    'filter' => ['IBLOCK_ID' => $catalogIblockId, 'CODE' => $article],
    'select' => ['ID', 'NAME'],
]);

If article not found — log as "unrecognized item" (don't create automatically, catalog clutter risk).

Logging and Quality Control

A critical part often ignored. Each import run must log:

  • Number of rows in file.
  • Number of updated items.
  • Number of unrecognized articles (with list).
  • File read errors.
  • Execution time.

Log stored in "Import Log" infoblock or separate table. Email notification to admin on non-zero error count.

Performance with Large Price Lists

A 50,000-item price list with naive approach (DB query per row) will process for hours. Right strategy:

  1. Batch reading: read Excel in 1000-row blocks, don't load entire file in memory.
  2. Article cache: before import load all existing articles into array ['ARTICLE' => 'BITRIX_ID']. Search in-memory array instead of DB query per item.
  3. Bulk updates: instead of UPDATE per row — use transaction or batch API.

Development Timeline

Scale Scope Timeline
Single supplier, Excel/CSV Parser + price and stock import 2–3 days
Multiple suppliers Configurable mapping system 4–6 days
Complete system All formats, supplier management UI, logs 7–10 days