Quick Order by SKU Feature Development for 1C-Bitrix
On wholesale and B2B sites, buyers know the SKU — they do not want to search through a catalog. They need an input field: type the SKU, specify the quantity, add to cart. The standard 1C-Bitrix search (search.title) is not suitable for this: it searches by name, is slow on large catalogs, and does not support bulk input. Quick order by SKU is a separate UI block with direct database queries against an indexed field.
Product search by SKU
In 1C-Bitrix, the SKU is stored in an infoblock property (PROPERTY_ARTICLE) or in the element's XML_ID field. For trade offers — in the offer property (PROPERTY_CML2_ARTICLE when imported from 1C).
AJAX search controller:
public function searchByArticleAction(string $query): array
{
$result = [];
// Search among trade offers
$offerIblockId = \CCatalogSKU::GetInfoByProductIBlock(CATALOG_IBLOCK_ID)['IBLOCK_ID'];
$rs = \CIBlockElement::GetList(
['NAME' => 'ASC'],
[
'IBLOCK_ID' => $offerIblockId,
'PROPERTY_CML2_ARTICLE' => '%' . $query . '%',
'ACTIVE' => 'Y',
],
false,
['nTopCount' => 10],
['ID', 'NAME', 'IBLOCK_ELEMENT_ID', 'PROPERTY_CML2_ARTICLE']
);
while ($item = $rs->Fetch()) {
$result[] = [
'sku_id' => (int)$item['ID'],
'product_id' => (int)$item['IBLOCK_ELEMENT_ID'],
'article' => $item['PROPERTY_CML2_ARTICLE_VALUE'],
'name' => $item['NAME'],
];
}
return $result;
}
For performance on catalogs with 50,000+ SKUs — add an index on the property column:
CREATE INDEX idx_iblock_prop_article
ON b_iblock_element_property (IBLOCK_PROPERTY_ID, VALUE)
WHERE VALUE IS NOT NULL;
Quick order interface
The block is a table with dynamic rows: each row has a SKU field with autocomplete, a quantity field, and a delete button. At the bottom is an "Add all to cart" button.
Autocomplete is implemented with a debounce(300ms) on the input field: when 3 or more characters are entered, an AJAX request fires to searchByArticleAction, and results are shown in a dropdown. When a product is selected, the row is populated with data showing a preview (thumbnail, name, current price).
Bulk input — an additional tab where a list can be pasted in the format:
SKU QUANTITY
ABC-123 5
XYZ-456 10
Parsed in JS, then a batch AJAX request resolves all SKUs at once.
Adding to cart
After confirmation — batch add to cart via \Bitrix\Sale\BasketItem:
$basket = \Bitrix\Sale\Basket::loadItemsForFUser(
\Bitrix\Sale\Fuser::getId(), SITE_ID
);
foreach ($items as $item) {
$basketItem = $basket->createItem('catalog', $item['product_id']);
$basketItem->setFields([
'QUANTITY' => $item['quantity'],
'PRODUCT_PROVIDER_CLASS' => \Bitrix\Catalog\Product\Basket::class,
'MODULE' => 'catalog',
]);
}
$basket->save();
When adding trade offers, the offer's PRODUCT_ID is passed with the link to the parent element via PROPS — this is required when using SKUs.
Error handling
- SKU not found → row highlighted in red, tooltip "Product not found"
- Product out of stock → warning with available quantity from
b_catalog_store_product - Multiple matches for a SKU → dialog to select the correct SKU
What is included in development
- AJAX controller for SKU search with trade offer support
- UI block with dynamic rows, autocomplete, and product preview
- Bulk input mode (paste a list of SKU + quantity)
- Batch add to cart via
\Bitrix\Sale\Basket - Error handling: not found, out of stock, multiple matches







