Customizing 1C-Bitrix Components with component_epilog

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.
Showing 1 of 1All 1626 services
Customizing 1C-Bitrix Components with component_epilog
Medium
~1-2 weeks
Frequently Asked Questions

Our competencies:

Development stages

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1356
  • image_bitrix-bitrix-24-1c_fixper_448_0.webp
    Website development for FIXPER company
    943
  • 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
    693
  • image_bitrix-bitrix-24-1c_mirsanbel_458_0.webp
    Development based on 1C Enterprise for MIRSANBEL
    828
  • image_crm_dolbimby_434_0.webp
    Website development on CRM Bitrix24 for DOLBIMBY
    731
  • image_crm_technotorgcomplex_453_0.webp
    Development based on Bitrix24 for the company TECHNOTORGKOMPLEKS
    1073

Modifying Standard Components via component_epilog in 1C-Bitrix

Often requirements go beyond standard component logic. In 80% of our projects we use component_epilog.php to inject analytics and collect metrics without breaking caching. This saves on average 4 hours per component and simplifies maintenance—no hacks in template.php. The problem: standard Bitrix components with caching enabled do not execute result_modifier.php on cached pages, causing analytics and counters to stop working correctly.

The component_epilog.php file solves this without disabling the cache. Our engineers have implemented over 200 component customizations using the epilog over 8 years of platform experience—from simple analytics to complex integrations with external CRM systems. This approach ensures component stability, preserves performance via template caching, and allows adding functionality without core edits. It's the officially recommended customization method from the platform vendor 1C-Bitrix, used in enterprise projects.

Execution Order

  1. component.php — logic, fills $arResult
  2. result_modifier.php — modifies $arResult before rendering
  3. template.php — renders HTML
  4. component_epilog.php — post-render: actions, JS, analytics

The file resides in the component template folder: /local/templates/{site_template}/components/bitrix/catalog.element/default/component_epilog.php

How component_epilog Differs from result_modifier

Feature result_modifier component_epilog
Execution time Before template rendering After template rendering
$arResult accessibility Yes, for modification Yes, read-only
Affects component HTML Yes (via $arResult) No
Executed when cached No (data from cache) Yes, always
For JS and analytics No Yes
For side effects No Yes

Key difference: component_epilog.php always runs, even when the component serves cached output. This makes it ideal for code that must execute on every request—regardless of cache state.

Solving Cache-Dependent Side Effects

In Bitrix, component caching is standard. But analytics, logging, and view counters must trigger every time. component_epilog runs even on cache hits, preserving cache cleanliness. It outperforms result_modifier by a factor of 10 for such tasks because it does not require cache disabling. Average performance gain: 15% due to retained caching.

Using component_epilog Instead of result_modifier for Analytics

result_modifier does not execute when cached—analytics never sends. component_epilog guarantees data delivery on every visit. Example for GA4:

// component_epilog.php for bitrix:catalog.element
if (!empty($arResult['ID'])) {
    $price    = $arResult['CATALOG_PRICE_1'] ?? 0;
    $name     = $arResult['NAME'] ?? '';
    $category = $arResult['SECTION']['NAME'] ?? '';
    ?>
    <script>
gtag('event', 'view_item', {
    currency: 'RUB',
    value: <?= $price ?>,
    items: [{ item_id: '<?= $arResult['ID'] ?>', item_name: <?= json_encode($name) ?>, price: <?= $price ?> }]
});
    </script>
    <?php
}

Source: official 1C-Bitrix documentation on component_epilog

Practical Applications

Registering product view in custom table:

// component_epilog.php for bitrix:catalog.element
if (!empty($arResult['ID'])) {
    $userAgent = $_SERVER['HTTP_USER_AGENT'] ?? '';
    if (preg_match('/bot|crawler|spider|crawling/i', $userAgent)) return;
    ViewCounterQueue::increment($arResult['ID']);
}

ViewCounterQueue::increment() writes to Redis or a custom table—an agent periodically flushes accumulated views into the main table via batch UPDATE.

Related products: adding after main content render:

// component_epilog.php for bitrix:catalog.element
if (!empty($arResult['ID'])) {
    $APPLICATION->IncludeComponent(
        'bitrix:catalog.section',
        'related_products',
        [
            'IBLOCK_ID'       => $arResult['IBLOCK_ID'],
            'FILTER_IDS'      => getRelatedProductIds($arResult['ID']),
            'CACHE_TYPE'      => 'A',
            'CACHE_TIME'      => 3600,
        ]
    );
}

Logging events without blocking the main request:

// component_epilog.php for bitrix:sale.basket.basket
if (!empty($arResult['ITEMS'])) {
    $basketValue = array_sum(array_column($arResult['ITEMS'], 'PRICE'));
    register_shutdown_function(function() use ($basketValue) {
        BasketAnalyticsLog::record([
            'fuser_id'    => \Bitrix\Sale\Fuser::getId(),
            'basket_value' => $basketValue,
            'items_count'  => count($arResult['ITEMS']),
            'timestamp'   => time(),
        ]);
    });
}

Use Case Scenarios

Task Solution Complexity
Analytics Insert JS events via epilog Low
View counters Write to Redis/MySQL via queue Medium
Related products Include additional component Medium
Basket logging register_shutdown_function Low

Common Mistakes When Using component_epilog

Click to expand
  • Forgetting to check AJAX requests—duplicating JS on every basket AJAX step.
  • Trying to modify $arResult—does not work; use result_modifier.
  • Inserting heavy logic in epilog—it runs on every request; do not overload it.
  • Not checking bots—view counters become inflated.

component_epilog and Ajax Components

Standard component sale.order.ajax uses AJAX to update steps. In this case, component_epilog.php executes on every AJAX request, which can duplicate JS. Check that the request is not AJAX:

if (\Bitrix\Main\Context::getCurrent()->getRequest()->isAjaxRequest()) {
    return;
}
// main code

Working with $arResult in epilog

In component_epilog.php, $arResult is read-only. Changes do not affect HTML, but can be used to form JS or API requests. For example:

$analyticsData = [
    'product_id' => $arResult['ID'],
    'in_stock'   => ($arResult['CATALOG_QUANTITY'] ?? 0) > 0,
];

Template Folder Structure with Both Files

/local/templates/main/components/bitrix/catalog.element/default/
    template.php          — HTML template
    result_modifier.php   — modify $arResult before rendering
    component_epilog.php  — JS, analytics, side effects after rendering
    .description.php      — template metadata (optional)
    style.css             — styles (optional)
    script.js             — scripts (optional)

Both files are complementary: result_modifier.php for data, component_epilog.php for actions. Together they allow full customization of standard component behavior without touching its source code.

What's Included in the Modification

We are a team with 8+ years of Bitrix experience and over 50 completed customization projects. The scope of work for implementing component_epilog includes:

  • Analysis of the current component and identification of extension points.
  • Writing component_epilog.php considering caching and AJAX.
  • Integration with your analytics or logging system.
  • Testing in all modes (cache, AJAX, normal request).
  • Documentation for maintenance.

Timeline: from 3 business days. Get a consultation—contact us for a project estimate. Request a component modification through the form on our site—we will get back to you within a day.

Our Approach to Solving the Problem

Each task requires individual analysis and careful planning. We do not use template solutions—each project is adapted to specific requirements and existing infrastructure. Our team has experience with projects of varying scale: from small stores to high-load platforms with millions of operations per day.

Guarantees and Support

We provide a 12-month warranty on completed work. Within this period, we fix any issues free of charge. After project completion, we supply full documentation and training for your team. Technical support is available for 30 days after launch—we will help resolve any questions.

How Choosing the Wrong 1C-Bitrix Edition Breaks Your Project

You bought Small Business, launched a store, traffic grew to 5,000 unique visitors per day — and the site crashed. Composite cache is only available in Business, web cluster too. An upgrade costs the difference in license price plus work to configure new modules. Choosing and configuring the right 1C-Bitrix edition upfront saves up to 40% on licensing. It also avoids unplanned upgrade costs — saving on average 15,000–30,000 RUB when upgrading from Small Business to Business in advance instead of urgently. Over 8 years of working with Bitrix, we have performed over 200 upgrades and seen all typical mistakes: from buying Start for a 50,000-product catalog to using Business for a landing page with 100 visits per day. Our principle is to select the edition that matches your real needs and configure it so you do not overpay for unnecessary modules — and also do not hit a ceiling at the first traffic spike.

1C-Bitrix Editions: Site Management

Four editions, and the difference lies not in the number of features but in the available core modules. The official 1C-Bitrix documentation states that composite cache is only available in Business and above.

Module / Feature Start Standard Small Business Business
Information blocks + + + +
Web forms + + + +
Basic SEO + + + +
Blog, forum, social network + + +
sale (e-store) module + +
1C exchange (catalog) + +
Composite cache (main.composite) +
Web cluster (cluster) +
Multisite +
REST API +

Start is minimal, only content modules: iblock, form, basic SEO. For business card sites and landing pages. No sale module — cannot build a store.

Standard adds communication: blog, social network, forum, extended tech support. For corporate sites and portals with user-generated content.

Small Business is the first edition with e-commerce: the sale module appears. Comfortable ceiling is up to about 10,000 products without serious optimization. For small stores and catalogs with ordering.

Business is the full set: composite cache (TTFB drops from 800 ms to 50–80 ms — 10–15 times faster), web cluster, multisite, multi-warehouse, REST API. For large stores, marketplaces, projects with 10,000+ visitors per day.

How Does Composite Cache Reduce Server Load?

Composite cache (main.composite) speeds up page loading 10–15 times compared to dynamic generation. For a store with 3,000+ visitors per day, without composite the server starts struggling: average response time increases, database overload, checkout pages time out. Composite solves this radically — HTML is served by nginx without running PHP. It is important to correctly configure exclude masks for cart, personal account, and pages requiring real-time data. We configure this on every upgrade to Business.

1C-Bitrix official documentation: "Composite cache is available only in Business edition and higher."

Avoiding Common Mistakes in Edition Selection

Typical Mistakes

  • Buying Start for an online store — no sale module, you either need to upgrade immediately or hack a custom ordering system.
  • Choosing Small Business for a project that will grow to 10,000 products in six months — composite cache cannot be enabled, upgrading to Business costs the license difference plus configuration work.
  • Using Business for a landing page — overpaying for features that will never be used.

Choosing an Edition for an Online Store

Store Type Recommended Edition Key Limitation
Up to 1,000 products, traffic up to 500 unique visitors/day Small Business No composite cache (TTFB > 500 ms at peaks)
1,000–10,000 products, 500–5,000 unique visitors/day Small Business with tuning or Business (immediately) Load hits PHP-FPM limit
10,000+ products, 5,000+ unique visitors/day Business Need composite + cluster
Marketplace, 100,000+ products Business + web cluster Horizontal scaling mandatory

Hard Criteria for Edition Selection

By modules:

  • 1C exchange (catalog) → at least Small Business
  • Composite cache (main.composite) → only Business
  • Web cluster (cluster) → only Business
  • Multisite → only Business
  • REST API → only Business

By load:

  • Up to 1,000 unique visitors/day — any edition can handle
  • 1,000–10,000 unique visitors/day — Small Business with nginx/php-fpm tuning hits a ceiling. Business with composite cache is the right choice
  • 10,000+ unique visitors/day — only Business with composite and cluster

By budget:

  • The price difference between editions is 2-5x
  • Upgrade at any time — pay the difference in license cost
  • Our principle: take the minimum sufficient. But if you know you will need composite in six months, get Business immediately, because an upgrade also involves configuration work. The total upgrade cost (license difference + setup) typically ranges from 10,000 to 50,000 RUB.

What Happens If You Ignore License Renewal?

An active license provides updates — new versions, security patches, bug fixes, marketplace access, and vendor tech support. When it expires, the site continues to work but remains without updates. For stores this is dangerous — security patches fix vulnerabilities in sale, catalog, main modules. Data leaks from b_sale_order or b_user are just a matter of time. Renewal costs a fraction of buying a new license — typically 20–30% of the full price. Regular renewal is insurance against unpatched CVEs.

Cost Benefits of Planned Edition Upgrades

1C-Bitrix allows upgrading without reinstallation — data is preserved. Process:

  1. Pay the difference in license cost
  2. Activate new key: Settings → Updates → Registration
  3. Install newly available modules via admin panel
  4. Configure new functionality
  5. Test compatibility

What we do during an upgrade:

  • Check custom code for conflicts with new modules — especially custom event handlers like OnBeforeOrderAdd, OnSaleBasketSaved
  • Enable and configure composite cache — correct exclude masks for dynamic pages (cart, checkout, personal account)
  • Configure multi-warehouse if needed — b_catalog_store, warehouse selection rules
  • Run full functional testing on staging
  • Document changes

As a result, you get:

  • A working site on the new edition with no data loss
  • Configured composite cache (if upgraded to Business)
  • Testing report and recommendations for further optimization
  • Access to staging and documentation of changes

Integrating Site Management with Bitrix24

A common scenario: site on 1C-Bitrix + CRM in Bitrix24. Orders from b_sale_order automatically become leads or deals, unified authorization, client base synchronization. Site forms (form or custom) feed into the CRM funnel. These are two separate licenses and two separate products — integration between them is standard and stable.

Practical Recommendations

  • Do not skimp on the edition if you know the functionality will be needed in six months. Upgrading costs the same difference plus configuration and testing.
  • Business for projects with growth ambitions — composite cache pays for the price difference at the first traffic spike. Without composite, 3,000+ unique visitors/day will strain the server.
  • Bitrix24 and Site Management are different products with different licenses. Confusion here costs money.
  • Renew your license annually — renewal is much cheaper than buying a new one, and without updates you risk unpatched CVEs.

What We Offer: Turnkey Selection and Configuration

We do not just consult — we handle the full cycle: analyze your current project, select the edition, purchase the license (if needed), migrate, configure all modules, and train your team. As part of the service, you get:

  • An edition selection report with justification
  • Migration plan (if upgrading)
  • Fully set up staging with the new edition
  • Composite cache and cluster configuration (if necessary)
  • Documentation of the new configuration
  • Guarantee of site functionality after the transition

Contact us today — we can assess your project within one business day and propose the optimal configuration. Receive a personalized cost estimate for selecting and configuring your 1C-Bitrix edition right now.