Parsing inventory balances from supplier websites 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 Product Stock Levels from Supplier Websites for 1C-Bitrix

The situation: the supplier provides no API, sends price lists once a week by email, and actual stock levels change daily. A customer places an order — the item is out of stock. The solution is to parse the supplier's storefront and update the CATALOG_QUANTITY field in 1C-Bitrix.

What exactly to parse

Stock levels on a supplier's website can be represented in different ways:

  • Numeric value ("in stock: 47 pcs") — parse the number directly
  • Availability status ("in stock" / "on order" / "out of stock") — map to 0/1/999
  • Multiple warehouses — sum them up or take the nearest warehouse

Sometimes stock levels are embedded in JS variables on the page (window.__PRODUCT_DATA__ = {...}) — locate them via regex in the page body; this is faster than a headless browser.

Linking your catalog products to supplier items

This is the key step. Without reliable mapping, parsing is useless. Options:

Supplier SKU — add a SUPPLIER_SKU property to the infoblock. During parsing, find the element with that value via CIBlockElement::GetList() filtered by the property.

XML_ID — if products were previously imported from the supplier's price list, the XML_ID may match their internal ID.

EAN/barcode — a universal option for branded products.

For large catalogs (10,000+ SKUs), filtering by property through the ORM is slow. It is better to build a reverse mapping supplier_sku → element_id in Redis or a custom table and update it whenever the catalog changes.

Updating stock levels in 1C-Bitrix

Update via CCatalogProduct::Update():

CCatalogProduct::Update($elementId, [
    'QUANTITY' => $parsedQty,
    'QUANTITY_RESERVED' => 0,
]);

If the store uses warehouses (b_catalog_store), update via CCatalogStoreProduct::Update() specifying STORE_ID.

Important: when updating only the quantity, do not touch ACTIVE — otherwise you will lose manual activity edits. Make a separate UPDATE for only the required field.

Logic for handling "out of stock"

Do not automatically hide a product when stock reaches zero — the supplier may restock the next day. Correct logic:

  1. Quantity = 0 → the product stays active, but an "on order" flag is added
  2. Quantity = 0 for more than N days → notify the manager, manual decision required
  3. Product not found on the supplier's site 3+ times in a row → set SUPPLIER_DISCONTINUED flag

Flags are implemented via infoblock properties or Highload block fields.

Work timeline

Phase Duration
Analyzing the supplier's site, choosing the parsing method 2–4 hours
Developing the stock level parser 1–2 days
Configuring SKU mapping 4–8 hours
Update logic in 1C-Bitrix + handling zero stock 4–8 hours
Setting up schedule and monitoring 2–4 hours

Total: 3–5 working days per supplier. Each additional supplier adds 1–2 days (different site structures).