Setting up QR codes for quick product access in 1C-Bitrix
Warehouse worker scans QR code on box and lands on product card in catalog. Marketer prints QR on price tag in offline store — customer scans and sees reviews, specs, "Buy" button. Task is technically simple but implementation details determine whether system works stably with thousands of products.
Forming URL for QR
QR code is encoded URL. Question is which URL to encode.
Direct product link (https://shop.by/catalog/product/artikul-123/) — works until SEO-friendly address changes. Renamed catalog section — all printed QR codes became broken.
Redirect link by ID (https://shop.by/qr/1234/) — more reliable. Create PHP page or handler in urlrewrite.php that gets current URL by product ID via CIBlockElement::GetByID() and makes 301-redirect. QR code doesn't depend on catalog structure.
Link by XML_ID or article (https://shop.by/qr/?sku=ART-0042) — best option for 1С integration where article is main identifier. Handler searches element by ARTICLE property and redirects.
QR code generation
QR is generated on server by PHP library. Two working options:
- chillerlan/php-qrcode — compact, no dependencies, generates SVG and PNG.
- endroid/qr-code — more features (logo inside QR, colors) but heavier.
Install via Composer: composer require chillerlan/php-qrcode. Generate in catalog.element component: in result_modifier.php add code creating QR SVG string for current product. SVG embed in template via $arResult['QR_CODE_SVG'].
For mass generation (catalog print, labels) create separate page /admin/qr-export/ generating PDF with QR codes for selected products. TCPDF or Dompdf library handles the task.
Caching and performance
Generating one QR takes 5–15 ms. On catalog page with 30 products — up to 450 ms just on QR. Solution: generate QR once and save as file to /upload/qr/{ELEMENT_ID}.svg. When product URL changes (event OnAfterIBlockElementUpdate) — delete file so new one generates on next request.
UTM tags and analytics
Add UTM parameters to URL inside QR: ?utm_source=qr&utm_medium=offline&utm_campaign=price_tag. This allows tracking in Yandex.Metrica and Google Analytics how many clicks offline media give. Parameters don't affect redirect — handler just passes them through.







