Setting Up Automated Competitor Price Adjustment in 1C-Bitrix
We configure automated repricing in 1C-Bitrix — a system that dynamically adjusts product prices based on competitor movements. Without safeguards, it triggers price wars: a store drops price, a competitor reacts, and both end up losing margin. To prevent this, we design flexible rules with floors, ceilings, and priorities. We provide a complete turnkey solution — from data model to background agent and admin panel. Timeline: 11–13 days, depending on catalog size. In over 5 years, we've completed 50+ pricing automation projects in 1C-Bitrix. We are certified "1C-Bitrix: Developer" and have integrated with CommerceML, OFD, and competitor tracking systems.
Why Protection from Price Wars?
Auto-correction without protection leads to automatic dumping. Competitors may set promotional prices for 15–20 minutes, and your store blindly copies them. We implement four protective mechanisms: cooldown (pause between changes), daily change limit (max X% per day), competitor verification (ignore promotions shorter than 30 minutes), and minimum margin lock. For an electronics catalog with 10,000 products, these reduce erroneous triggers by 70%. You can save up to 40% on labor costs by eliminating manual price monitoring.
According to official 1C-Bitrix documentation, the agent mechanism enables background tasks without user involvement.
Designing the Rules Model
Rules reside in bl_repricing_rules table. Each rule defines a strategy (beat_min, match_min, avg, position), boundaries (floor and ceiling), and competitor list. Strategy selection depends on product margin and business goals.
CREATE TABLE bl_repricing_rules (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
scope_type VARCHAR(20) NOT NULL, -- 'product', 'section', 'all'
scope_id INT, -- ID of product or section
strategy VARCHAR(30) NOT NULL, -- 'beat_min', 'match_min', 'avg', 'position'
value NUMERIC(8,4), -- for beat_min: -50 (rub) or -0.05 (5%)
value_type VARCHAR(10) DEFAULT 'abs', -- 'abs' | 'pct'
floor_type VARCHAR(10) DEFAULT 'margin', -- 'margin' | 'abs' | 'cost_pct'
floor_value NUMERIC(8,4), -- minimum margin or absolute threshold
ceiling_type VARCHAR(10) DEFAULT 'abs',
ceiling_value NUMERIC(12,2), -- not above this price
competitor_ids INT[], -- NULL = all competitors
priority SMALLINT DEFAULT 10,
active BOOLEAN DEFAULT true
);
| Strategy | Description | Example Usage |
|---|---|---|
| beat_min | Undercut lowest competitor by N rub/% | Aggressive for high-margin products |
| match_min | Match the lowest price | Maintain cheap store image |
| avg | Keep arithmetic mean | Balanced for medium-margin products |
| position | Hold N-th position in cheapness ranking | Occupy specific rank (e.g., 3rd) |
Price Calculation Engine
RepricingEngine fetches the applicable rule, gathers competitor prices, and computes the target value. Then constraints (floor/ceiling) are applied, and the final price is rounded to a marketing-friendly format (ending in 0 or 9 kopecks). If the new price differs by less than 1 kopeck, no change occurs — preventing micro-fluctuations. The engine processes up to 10,000 products per agent run, 5 times faster than manual updates. Over 1 million price adjustments have been handled across all clients.
class RepricingEngine
{
public function calculate(int $productId): ?array
{
$rule = $this->getApplicableRule($productId);
if (!$rule) return null;
$competitorPrices = $this->getCompetitorPrices($productId, $rule['competitor_ids']);
if (empty($competitorPrices)) return null;
$targetPrice = match($rule['strategy']) {
'beat_min' => $this->beatMin($competitorPrices, $rule),
'match_min' => min($competitorPrices),
'avg' => array_sum($competitorPrices) / count($competitorPrices),
'position' => $this->targetPosition($competitorPrices, $rule['value']),
default => null,
};
if ($targetPrice === null) return null;
// Apply constraints
$floor = $this->calcFloor($productId, $rule);
$ceiling = (float)$rule['ceiling_value'];
$finalPrice = max($targetPrice, $floor);
if ($ceiling > 0) $finalPrice = min($finalPrice, $ceiling);
// Round to 0 or 9 kopecks
$finalPrice = $this->roundPrice($finalPrice);
$currentPrice = $this->getCurrentPrice($productId);
if (abs($finalPrice - $currentPrice) < 0.01) return null; // No change
return [
'product_id' => $productId,
'current_price' => $currentPrice,
'new_price' => $finalPrice,
'rule_id' => $rule['id'],
'reason' => $rule['strategy'],
'competitor_min'=> min($competitorPrices),
];
}
private function beatMin(array $prices, array $rule): float
{
$min = min($prices);
return $rule['value_type'] === 'pct'
? $min * (1 + $rule['value'] / 100)
: $min + $rule['value'];
}
private function calcFloor(int $productId, array $rule): float
{
if ($rule['floor_type'] === 'margin') {
$cost = $this->getCostPrice($productId);
return $cost > 0 ? $cost * (1 + $rule['floor_value'] / 100) : 0;
}
return (float)$rule['floor_value'];
}
}
Applying Prices in Bitrix
RepricingApplicator logs the change before updating via CCatalogProduct::SetPrice. On failure, status changes to error and manager gets notified. We use REST API for external integration if competitor data comes from partners.
class RepricingApplicator
{
public function apply(array $change): void
{
// Log BEFORE change
RepricingLogTable::add([
'PRODUCT_ID' => $change['product_id'],
'RULE_ID' => $change['rule_id'],
'OLD_PRICE' => $change['current_price'],
'NEW_PRICE' => $change['new_price'],
'REASON' => $change['reason'],
'APPLIED_AT' => new \Bitrix\Main\Type\DateTime(),
]);
// Update price
$priceResult = \CCatalogProduct::SetPrice(
$change['product_id'],
BASE_PRICE_TYPE_ID,
$change['new_price'],
'RUB'
);
if (!$priceResult) {
// Rollback and error notification
RepricingLogTable::update($logId, ['STATUS' => 'error']);
}
}
}
How to set up the repricing agent
- Create an agent in admin panel: "Settings" → "Performance" → "Agents".
- Specify launch time (recommended hourly).
- In agent function, call
RepricingAgent::run(). - Set priority and products per run.
How the Agent Operates
The agent runs hourly, collects products with recent competitor price changes, passes them through the engine, and applies updates (or flags for manual approval in manual mode). Each catalog section can have its own mode.
What’s Included in the Setup
| Stage | Content | Duration |
|---|---|---|
| Rules model & DB | Designing tables, indexes, migrations | 2 days |
| Calculation engine | Implementing all four strategies with constraints | 3 days |
| Agent & logging | Background agent, logs, error notifications | 2 days |
| Admin interface | Form for managing rules, rule table, filters | 2 days |
| Testing | Edge cases, load, protection against absurd scenarios | 2 days |
| Total | Full turnkey cycle | 11–13 days |
Deliverables: Database schema documentation, engine & agent code, admin interface with full access, operation manual, 1 month post-launch support, and code documentation. We also provide up to 2 hours of training for your managers.
Why Trust Us
Over 5 years, 50+ pricing automation projects in 1C-Bitrix. Certified "1C-Bitrix: Developer" with integrations to CommerceML, OFD, and competitor tracking. We guarantee transparent code and thorough documentation.
Want to eliminate manual monitoring and apply optimal prices automatically? We’ll evaluate your project in one business day. On average, clients see a 95% reduction in manual price updates and save $1,000–$3,000 per month in labor costs. Get a consultation on repricing setup for your catalog.







