Custom Wholesale Order Module for 1C-Bitrix

Developing a custom wholesale order module for 1C-Bitrix solves the problem of processing orders with hundreds of line items. Tabular input with AJAX search, Excel/CSV import, and drafts replace manual search through filters. The standard `bitrix:sale.basket` component is not suitable — we create a

Our competencies:

Frequently Asked Questions

Developing a custom wholesale order module for 1C-Bitrix solves the problem of processing orders with hundreds of line items. Tabular input with AJAX search, Excel/CSV import, and drafts replace manual search through filters. The standard bitrix:sale.basket component is not suitable — we create a turnkey module with stock reservation and 1C integration. Data exchange with ERP is implemented via the CommerceML standard. With 100 orders per month, time savings amount to 50 hours, which at a manager rate of 600 RUB/hour gives 30,000 RUB savings monthly.

Quick Order Entry: Three Scenarios

Tabular input with autocomplete. The user enters an article number in a row, the field autocompletes via an AJAX request to a custom handler that searches b_iblock_element with an index on CODE and XML_ID. After selecting an item, the price, stock, and unit of measure fields are filled automatically. Rows in the table are added dynamically via JS.

Import from Excel/CSV. The file is uploaded through a file field component, parsed on the server via PhpSpreadsheet or fgetcsv. Expected format: article number, quantity, optionally comment. The parsing result is a list of items with found and unfound article numbers. Unfound ones are shown separately for manual matching. Found items are added to the order draft.

Repeat order. The "Repeat order" button in history — takes CSaleOrder::GetByID(), iterates over CSaleBasket::GetList() with ORDER_ID, checks current availability of each item. Items with zero stock are marked with a warning but do not block draft creation.

The custom module processes import of 5000 items in 2 seconds, whereas the standard basket takes 30 seconds (15 times faster). Get a consultation for your project — we'll calculate timelines and budget.

Module Architecture

The module is placed in local/modules/project.wholesale/. Structure:

install/ index.php — installer, registers event handlers lib/ OrderDraft.php — order draft entity (D7 DataManager) Importer.php — Excel/CSV parsing PriceProvider.php — priority pricing StockChecker.php — stock check options.php — module settings in admin panel 

The order draft is an intermediate storage until confirmation. Table b_project_order_draft: ID, USER_ID, COMPANY_ID, ITEMS (JSON), STATUS (editing, pending_approval, confirmed), CREATED_AT, UPDATED_AT. The JSON field ITEMS contains items with article number, quantity, price at the moment of draft creation, and confirmed price. This is important: the price is fixed in the draft to avoid discrepancies during approval.

Converting a draft to an order. When the draft is confirmed, a standard order is created via Bitrix\Sale\Order::create(). All items are added via Bitrix\Sale\Basket::create() with explicit prices from the draft. Standard price recalculation is disabled for these items — otherwise personal prices could be overwritten. The official documentation describes creating via create() with site and user binding.

Why Stock Reservation Matters?

Wholesale orders without stock checks are a source of conflicts with the supply department. We implement two levels:

Soft check when adding an item to the draft: query CCatalogStoreProduct::GetList() with filter by PRODUCT_ID and STORE_ID. If the requested quantity exceeds available — show a warning but do not block. The buyer sees: Available: 45, you requested: 60. Partial shipment possible.

Reservation when moving to pending_approval status: create a record in b_catalog_store_product with a negative stock change (or in a separate reservation table). When the order is cancelled, the reservation is released. This prevents double booking of the same product by two buyers. Synchronization with 1C releases reservations automatically — when stock is updated via CommerceML, stocks are recalculated, and reservations are accounted for in b_catalog_store_product.QUANTITY_RESERVED.

What Is Volume Pricing?

Wholesale prices depend on volume: 1-10 units — price A, 11-50 — price B, 51+ — price C. In the standard catalog module, this is implemented via quantized prices (CCatalogProductPrice), but the management interface is inconvenient for a large assortment. In the module, we implement a custom interface for managing volume discounts: highload block wholesale_price_rules (UF_IBLOCK_SECTION_ID or UF_PRODUCT_ID, UF_QTY_FROM, UF_QTY_TO, UF_PRICE_TYPE — fixed or percentage of base). When an item is added to the draft, the quantity is determined and the appropriate rule is applied.

Units of Measure

A wholesale catalog often has multiple units: piece, pack (12 pcs), pallet (240 pcs). The catalog module supports measures via CCatalogMeasure and CCatalogMeasureRatio. In the wholesale interface, the buyer selects a unit — the quantity is automatically recalculated, as is the price.

Feature Comparison: Standard Basket vs Custom Module

Feature Standard Basket Custom Module
Tabular input No Yes, with AJAX search
Excel/CSV import No Yes (PhpSpreadsheet)
Order drafts No Yes (D7 entity)
Reservation No Yes, two-level
Volume pricing Via quantized prices (complex) Custom rules on HL block

How We Develop the Module: Step by Step

  1. Analysis of wholesale department business processes.
  2. Prototyping the tabular input interface.
  3. Module development with drafts and import.
  4. Integration with 1C via CommerceML.
  5. Testing on your assortment (up to 50,000 products).
  6. Delivery with documentation and training.

What Is Included

  • Module development with tabular input, import, and drafts.
  • Configuration of reservation and pricing.
  • Integration with 1C via CommerceML.
  • Testing on your assortment (up to 50,000 products).
  • API documentation for the module and instructions for managers.
  • Handover of access and training (2-hour call).
  • 6-month code guarantee.

Timeline

Component Duration
Tabular input with AJAX search 2-3 weeks
Excel/CSV import 1-2 weeks
Order draft (D7 entity + API) 2-3 weeks
Stock control and reservation 1-2 weeks
Volume pricing 1-2 weeks
Integration with approval module 1-2 weeks

Total: 8-14 weeks including testing and acceptance. Contact us for a consultation — we'll discuss your project and calculate the exact cost. Order the development of a wholesale order module.