Automated Stock Collection from Supplier Storefronts into 1C-Bitrix
Situation: the supplier provides no API, sends price lists once a week by email, but real stock changes daily. A customer places an order — the item is out of stock. We solve this by parsing the supplier's storefront and updating the CATALOG_QUANTITY field in 1C-Bitrix. Parsing isn't always HTML: often stock data sits in JSON variables on the page (window.__PRODUCT_DATA__). We use CURL and regex — faster than a headless browser and server-friendly. To avoid blocking, we apply random User-Agents and proxy rotation. Over 5 years on the market, we've automated stock collection for catalogs from 500 to 50,000 SKUs. Each project gets individual tuning — from parsing method selection to zero-stock handling logic. Request a parsing development — and we'll analyze your supplier's storefront for free.
How We Parse Stock from Supplier Websites
On the supplier's site, stock can be presented in various ways: numeric value (in stock: 47 pcs) — we directly parse the number; availability status (in stock, pre-order, none) — map to 0/1/999; multiple warehouses — we sum or take the nearest. Sometimes stock is hidden in JS variables — we search with regex in the page body, faster than a headless browser. If the supplier provides an API (rare), we connect via REST.
Why SKU Mapping Is the Tightest Bottleneck
A key stage. Without reliable mapping, parsing is useless. Options:
- Supplier SKU: add a
SUPPLIER_SKUproperty to the infoblock. While parsing, we search for the element with that value viaCIBlockElement::GetList()with a property filter. - XML_ID: if products were previously imported from the supplier's price list, XML_ID may match their internal ID.
- EAN/barcode: a universal option for branded products.
For large catalogs (10,000+ SKUs), filtering by property via ORM is slow. Better to build a reverse mapping supplier_sku → element_id in Redis or a custom table and update it on catalog changes.
How Stock Updates Work in Bitrix
According to 1C-Bitrix documentation, updating product quantity is done via the CCatalogProduct::Update method.
CCatalogProduct::Update($elementId, [ 'QUANTITY' => $parsedQty, 'QUANTITY_RESERVED' => 0, ]); If the store uses warehouses (b_catalog_store), we update via CCatalogStoreProduct::Update() with the STORE_ID specified.
When updating only the quantity, do not touch ACTIVE — otherwise you'll lose manual activity edits. Perform a separate UPDATE of only the needed field.
Handling Zero Stock Without Losing Sales
Don't automatically hide a product at zero stock — the supplier might restock the next day. The correct gentle logic:
- Quantity = 0 → product remains active, but gets a 'pre-order' flag.
- Quantity = 0 for more than N days → notify manager, manual decision.
- Product not found on supplier site 3+ times in a row → flag
SUPPLIER_DISCONTINUED.
We implement flags via infoblock properties or Highload-block fields.
Step-by-Step Process
- Supplier storefront analysis. Determine parsing method (HTML, JSON variables, API), prepare selectors.
- Parser development. PHP script with CURL, regex, optionally Guzzle. For blocking protection, use random User-Agents and proxies.
- SKU mapping setup. Link supplier SKUs to Bitrix product IDs. For catalogs 10,000+ SKUs, use Redis.
-
Bitrix integration. Agent or cron task, update stock via
CCatalogProduct::Update(). Test on a sample set of products. - Zero stock handling logic. Automatic flags, manager notifications. Test scenarios: product disappears, appears, price changes.
- Monitoring and support. After launch, parser runs stably; if supplier site structure changes, adaptation takes no more than a couple of hours.
What's Included in the Work
| Component | Description |
|---|---|
| Supplier storefront analysis | Determine parsing method (HTML, JSON variables, API), prepare selectors |
| Parser development | PHP script with CURL, regex, optionally Guzzle |
| SKU mapping | Link supplier SKUs to Bitrix product IDs |
| Bitrix integration | Agent or cron task, update stock via CCatalogProduct::Update() |
| Zero stock handling logic | Automatic flags, manager notifications |
| Documentation and support | Mapping scheme, instructions for adding a supplier, 2 weeks free support |
Timeline
| Stage | Duration |
|---|---|
| Supplier site analysis, parsing method selection | 2–4 hours |
| Parser development | 1–2 days |
| SKU mapping setup | 4–8 hours |
| Bitrix update logic + zero stock handling | 4–8 hours |
| Schedule and monitoring setup | 2–4 hours |
Total: 3–5 working days for one supplier. Each additional supplier — +1–2 days (different site structures).
We guarantee that after launch the parser will run stably, and if the supplier's site structure changes, adaptation will take no more than a couple of hours. Time savings on manual stock processing: up to 80% per month. Get a free assessment of your project — just contact us. Get a consultation right now.

