Integrating 1C-Bitrix with Barcode Scanners
A barcode scanner is the simplest peripheral device: it emulates a keyboard and types the scanned code into the active input field. The real challenge lies elsewhere — in what the system does with that code: finds a product, adds it to an order, or verifies a line item during picking. Integration setup is primarily about correct handling of scan events on the 1C-Bitrix side, not about configuring the scanner itself.
Scanner Types and Connection Methods
| Type | Connection | Keyboard emulation | Use case |
|---|---|---|---|
| USB HID | USB | Yes | POS, receiving |
| Bluetooth HID | Bluetooth | Yes | Mobile workstation |
| COM-port | RS-232 | No, direct port I/O | Legacy equipment |
| 2D imager (Honeywell, Symbol) | USB/BT | Yes | QR + barcode |
| Built into MDT | USB/WiFi | Via device API | Warehouse |
For most 1C-Bitrix use cases: a keyboard-emulating scanner works without drivers. No special configuration on the 1C-Bitrix side is needed — it is sufficient to handle input correctly in the form.
Product Search by Barcode
Barcodes are stored in 1C-Bitrix in the b_catalog_product_barcode table. Each product can have multiple barcodes (e.g. different packaging sizes: single unit and a case of 12, each with a different EAN).
public static function findByBarcode(string $barcode): ?array
{
$result = \Bitrix\Catalog\EO_ProductBarcode_Collection::wakeUp(
\Bitrix\Catalog\ProductBarcodeTable::getList([
'filter' => ['=BARCODE' => $barcode],
'select' => ['PRODUCT_ID', 'BARCODE'],
])
);
$row = $result->fetch();
if (!$row) return null;
// Load product data from the catalogue
$product = \CIBlockElement::GetByID($row['PRODUCT_ID'])->GetNext();
return [
'product_id' => $row['PRODUCT_ID'],
'name' => $product['NAME'],
'sku' => $product['PROPERTY_ARTICLE_VALUE'],
'price' => \CCatalogProduct::GetOptimalPrice($row['PRODUCT_ID'])['PRICE']['PRICE'] ?? 0,
'stock' => \CCatalogProduct::GetByID($row['PRODUCT_ID'])['QUANTITY'],
];
}
If the barcode is not found in b_catalog_product_barcode, the search falls back to the PROPERTY_BARCODE info block property (some projects store barcodes as a property). Both are unified in a single search method.
Adding to Cart by Barcode
Quick add component for a POS terminal or B2B section:
// Input field handler
const barcodeInput = document.getElementById('barcode-input');
barcodeInput.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
const barcode = e.target.value.trim();
if (!barcode) return;
fetch('/api/catalog/by-barcode/', {
method: 'POST',
headers: {'Content-Type': 'application/json', 'X-Bitrix-Csrf-Token': BX.bitrix_sessid()},
body: JSON.stringify({barcode})
})
.then(r => r.json())
.then(data => {
if (data.error) {
showError('Product not found: ' + barcode);
return;
}
addToCart(data.product_id, 1);
barcodeInput.value = '';
barcodeInput.focus();
});
}
});
Key point: the barcode input field must always retain focus. For POS terminals, autofocus is maintained with setInterval — the scanner can enter a code at any moment.
Verifying Line Items During Order Picking
When picking an order in the warehouse: the manager opens the order in the 1C-Bitrix admin panel and scans the barcode of each item. The system highlights the matching line in the order and marks it as "collected".
Custom page at /bitrix/admin/order_assembly.php:
// AJAX scan handler
if ($_REQUEST['action'] === 'scan_barcode') {
$barcode = trim($_REQUEST['barcode']);
$orderId = (int)$_REQUEST['order_id'];
$product = BarcodeService::findByBarcode($barcode);
if (!$product) {
echo json_encode(['status' => 'not_found', 'barcode' => $barcode]);
exit;
}
// Find the product in the order line items
$order = \Bitrix\Sale\Order::load($orderId);
$basket = $order->getBasket();
foreach ($basket as $item) {
if ($item->getProductId() === $product['product_id']) {
// Update the collected counter
AssemblyProgressTable::increment($orderId, $product['product_id']);
echo json_encode(['status' => 'ok', 'item_id' => $item->getId()]);
exit;
}
}
echo json_encode(['status' => 'not_in_order', 'product' => $product['name']]);
exit;
}
Inventory Counting via USB Scanner
For office inventory without an MDT: a dedicated page with a table where the manager scans barcodes and physically counts items. Each scan is an AJAX request that increments the position counter. At the end of the session — comparison with stock levels in b_catalog_store_product and export of discrepancies.
Scanner Suffix and Prefix Configuration
Some scanners append characters after the barcode by default (Tab, Enter + Carriage Return). Scanner settings are typically changed by scanning a configuration barcode from the manufacturer's manual. Recommended settings for 1C-Bitrix: suffix = Enter, no prefix, no CR.
Timeline
| Phase | Duration |
|---|---|
| Barcode product search API | 1 day |
| Quick add to cart component | 1–2 days |
| Order picking interface with scanner | 2–3 days |
| Inventory module | 2 days |
| Testing with a real scanner | 1 day |
| Total | 7–9 days |







