Setting up automatic ordering of goods from 1C-Bitrix suppliers

Our company is engaged in the development, support and maintenance of Bitrix and Bitrix24 solutions of any complexity. From simple one-page sites to complex online stores, CRM systems with 1C and telephony integration. The experience of developers is confirmed by certificates from the vendor.
Our competencies:
Development stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1175
  • image_bitrix-bitrix-24-1c_fixper_448_0.png
    Website development for FIXPER company
    811
  • image_bitrix-bitrix-24-1c_development_of_an_online_appointment_booking_widget_for_a_medical_center_594_0.webp
    Development based on Bitrix, Bitrix24, 1C for the company Development of an Online Appointment Booking Widget for a Medical Center
    564
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    747
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    655
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    976

Configuring Automatic Product Ordering from Suppliers in 1C-Bitrix

Automatic ordering from suppliers — when product stock falls below threshold, system creates purchase order without manager involvement. Requires: threshold values for each product, product-to-supplier binding, order creation and sending mechanism. Built on top of standard Bitrix modules.

Setting threshold values

Reorder threshold set for each product. Two storage options:

Option 1: infoblock custom properties — REORDER_POINT (quantity to order) and REORDER_QTY (how much to order). Set in product card in admin.

Option 2: separate bl_reorder_settings table with product_id, reorder_point, reorder_qty, supplier_id fields. Allows storing multiple suppliers per product with priorities.

For automatic threshold calculation use demand forecast from bl_sales_forecast: reorder_point = avg_daily_sales × lead_time_days × 1.2 (20% safety stock).

Stock monitoring agent

function AutoReorderAgent(): string
{
    $db = \Bitrix\Main\Application::getConnection();

    // Products below reorder threshold
    $result = $db->query("
        SELECT
            rs.product_id,
            rs.reorder_qty,
            rs.supplier_id,
            SUM(sp.AMOUNT) AS current_stock
        FROM bl_reorder_settings rs
        LEFT JOIN b_catalog_store_product sp ON sp.PRODUCT_ID = rs.product_id
        WHERE rs.active = 1
        GROUP BY rs.product_id, rs.reorder_qty, rs.supplier_id
        HAVING current_stock < rs.reorder_point
           AND NOT EXISTS (
               SELECT 1 FROM bl_supplier_orders so
               WHERE so.product_id = rs.product_id
                 AND so.status IN ('pending', 'sent', 'confirmed')
           )
    ");

    while ($row = $result->fetch()) {
        SupplierOrderService::create(
            $row['supplier_id'],
            $row['product_id'],
            $row['reorder_qty']
        );
    }

    return 'AutoReorderAgent();';
}

NOT EXISTS condition prevents duplication — don't create new order if active one exists.

Sending order to supplier

SupplierOrderService::create() creates record in bl_supplier_orders and sends order via method configured for supplier:

  • Email: forms PDF or Excel with items via \PHPExcel or standard Bitrix templates
  • API: HTTP request to supplier endpoint via \Bitrix\Main\Web\HttpClient
  • EDI: forms ORDERS message in EDIFACT/XML format and sends to FTP or API
class SupplierOrderService
{
    public static function create(int $supplierId, int $productId, float $qty): void
    {
        $orderId = SupplierOrderTable::add([
            'SUPPLIER_ID' => $supplierId,
            'PRODUCT_ID'  => $productId,
            'QTY'         => $qty,
            'STATUS'      => 'pending',
            'CREATED_AT'  => new \Bitrix\Main\Type\DateTime(),
        ])->getId();

        $supplier = SupplierTable::getById($supplierId)->fetch();

        match($supplier['ORDER_METHOD']) {
            'api'   => self::sendViaApi($supplier, $orderId, $productId, $qty),
            'email' => self::sendViaEmail($supplier, $orderId, $productId, $qty),
            'edi'   => self::sendViaEdi($supplier, $orderId, $productId, $qty),
        };

        SupplierOrderTable::update($orderId, ['STATUS' => 'sent']);
    }
}

Receiving confirmation and product arrival

Supplier confirms order and specifies expected delivery date. If supplier has API with webhooks — update status automatically. Otherwise — manager manually updates status in admin.

On actual product arrival, manager creates receipt document via "Warehouse → Documents → Receipt" in b_catalog_store_document. This automatically increases stock in b_catalog_store_product.

What we configure

  • bl_reorder_settings and bl_supplier_orders tables with needed statuses
  • AutoReorderAgent with stock vs threshold comparison logic
  • SupplierOrderService class with email, API, EDI adapters
  • Admin interface for viewing active supplier orders
  • Manager notifications about created auto-orders and overdue confirmations