Layout of the 1C-Bitrix component template

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
    1173
  • 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
    745
  • 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

Component Template Markup for 1C-Bitrix

The task sounds simple: "change the product card." In practice, the card turns out to be the template for the bitrix:catalog.element component, located at /bitrix/components/bitrix/catalog.element/templates/.default/ — which must not be touched (it will be overwritten on update). The override must be created in /local/ or in the site template folder, and the template.php itself uses $arResult variables whose structure is only partially documented.

Component Template Markup for 1C-Bitrix

The Template Override Mechanism

Bitrix looks for a component template in the following order (simplified):

  1. /local/templates/<site_template>/components/<namespace>/<component>/<template_name>/
  2. /bitrix/templates/<site_template>/components/<namespace>/<component>/<template_name>/
  3. /local/components/<namespace>/<component>/templates/<template_name>/
  4. /bitrix/components/<namespace>/<component>/templates/<template_name>/

The correct location for custom templates is /local/templates/<template>/components/ or /local/components/. This guarantees that templates survive core and module updates.

The minimum contents of a component template folder: template.php (required), style.css and script.js (connected automatically if present).

What Is Available Inside template.php

Inside template.php, the following are automatically available:

  • $arResult — data prepared by the component (structure depends on the specific component)
  • $arParams — parameters passed when the component was called
  • $APPLICATION, $USER, $DB — global Bitrix objects
  • $this — the component object (CBitrixComponent), providing methods such as $this->GetPath()

Before writing markup, always study the $arResult structure — via documentation, var_dump() / print_r() during development, or the bitrix:main.ajax.json component for debugging without polluting the cache.

Common Components for Custom Markup

bitrix:news.list / bitrix:news.detail — news, blog, portfolio. Most often, the list card and the detail page need to be changed. $arResult['ITEMS'] contains an array of elements with info block fields and properties.

bitrix:catalog.element / bitrix:catalog.section — product card and catalog section page. $arResult['ELEMENT'] contains product data, $arResult['OFFERS'] contains trade offers (variants).

bitrix:form.result.new — web form. The template contains HTML form fields generated from $arResult['FIELDS'].

bitrix:main.include — inclusion of static areas: banners, ad blocks, arbitrary HTML.

Case Study: Product Card Template with Tabs

An online medical equipment store. The standard bitrix:catalog.element template displayed the description, specifications, and documents as a single text block. Task: split into tabs — "Description", "Specifications", "Documents" (PDF files from a "File" type info block property).

We created an override at /local/templates/main/components/bitrix/catalog.element/detail/template.php. The template: tabs in pure CSS (:target selectors, no JS dependency), specifications from $arResult['ELEMENT']['DISPLAY_PROPERTIES'], documents from the "File" property with a check for non-empty values. Component caching was left untouched — the template works with the already-prepared $arResult.

Caching and Templates

Bitrix caches the component execution result, but not template.php itself — the template is rendered on every request against cached data. This is important: changes to template.php are visible immediately without clearing the cache. However, if a new field needs to be added to $arResult, either the component parameters must be changed (CACHE_GROUPS, CACHE_TIME), or a custom component must be created.

Timeline

Task type Timeline
Markup of a single simple component template 4–8 hours
Component template with complex logic (tabs, filtering, AJAX) 1–3 days
Set of templates (5–10 components) 1–2 weeks