Setting up predictive sales analytics on 1C-Bitrix

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 Predictive Sales Analytics in 1C-Bitrix

Predictive sales analytics — forecast of future sales based on historical data. For online store this answers questions: how many units of product X will sell next month, when to expect sales peak, which products to purchase in advance. In Bitrix, historical data exists — need to build processing pipeline.

Forecast data

From Bitrix all needed time series are available:

  • Sales by day: b_sale_order_basket JOIN b_sale_order grouped by DATE_INSERT::date
  • Product views: b_catalog_viewed_product by DATE_VISIT::date
  • Cart additions: b_sale_basket by DATE_INSERT::date
  • Conversion: ratio of orders to views by periods

Basic query for sales time series by product:

SELECT
    DATE(o.DATE_INSERT) AS sale_date,
    SUM(ob.QUANTITY)    AS qty_sold,
    SUM(ob.PRICE * ob.QUANTITY) AS revenue
FROM b_sale_order_basket ob
JOIN b_sale_order o ON o.ID = ob.ORDER_ID AND o.CANCELED = 'N'
WHERE ob.PRODUCT_ID = :product_id
  AND o.DATE_INSERT >= NOW() - INTERVAL '365 days'
GROUP BY DATE(o.DATE_INSERT)
ORDER BY sale_date;

Simple forecasting methods without ML

Moving Average — forecast for next period = average sales over last N weeks of similar period. Implemented in pure SQL.

Seasonal smoothing — multiply base forecast by seasonal coefficient. Coefficient is ratio of sales in specific month to average monthly for year based on historical data.

Linear trend — if sales grow 5% each month, extrapolate trend. Trend coefficient: regression via least squares method on historical sample.

These algorithms are implemented in PHP without external libraries — enough to work with data arrays from DB.

Storing forecasts

Create bl_sales_forecast table:

Field Type Description
product_id INT Product ID
forecast_date DATE Forecast date
predicted_qty FLOAT Predicted quantity
predicted_revenue FLOAT Predicted revenue
confidence_low FLOAT Confidence interval lower bound
confidence_high FLOAT Confidence interval upper bound
method VARCHAR Forecasting method
created_at TIMESTAMP Calculation date

Agent recalculates forecasts weekly for next 4–8 weeks for all active products.

Forecast dashboard in admin

In "Shop → Analytics" section add forecasts page. Component reads bl_sales_forecast and displays:

  • Plan/fact chart for selected product for last 3 months
  • Top 20 products with highest predicted demand for next week
  • Products where predicted demand exceeds current stock — signal to purchase

Chart built via Chart.js or ApexCharts, data loaded via AJAX from AdminForecastController.

Integration with inventory management

When forecast shows that in 2 weeks 50 units needed, but only 10 in stock — purchase recommendation created. Agent compares bl_sales_forecast.predicted_qty with b_catalog_store_product.AMOUNT and writes recommendations to bl_reorder_suggestions — same table used in auto-order service.

What we configure

  • SQL queries for building sales time series from b_sale_order_basket
  • Forecasting algorithms (moving average + seasonal coefficients) in PHP class SalesForecastEngine
  • Weekly forecast recalculation agent with write to bl_sales_forecast
  • Admin dashboard with plan/fact chart
  • Integration of forecasts with inventory management module via bl_reorder_suggestions