Development of "New Products" Block for 1C-Bitrix
The "New Products" block seems like a simple widget, but behind it lies a series of architectural decisions that determine whether it will be a living sales tool or static picture with "NEW" caption. The task is to display current new products automatically, without manual updates, with correct cache work and without performance degradation on catalogs with tens of thousands of items.
How "New Product" Logic Works
There are several approaches, and choice depends on how the project manages assortment.
By creation date. Most common option. A product is considered new if difference between DATE_CREATE of iblock element and current date doesn't exceed given threshold (usually 30–60 days). Query is built via CIBlockElement::GetList or \Bitrix\Iblock\Elements\ElementTable with filter by DATE_CREATE:
'>=DATE_CREATE' => date('d.m.Y', strtotime('-30 days'))
By special property. Manager manually marks products with "New" flag via "Checkbox" property or list. Flexible, but requires discipline from content team. To auto-remove flag after N days, add agent that iterates b_iblock_element_property and resets value.
By tagged criteria. If project has editorial control over assortment (manually determine what's new), use separate iblock section or smart filter group. Logic is simpler, management is transparent.
Component: Standard vs Custom
Standard bitrix:catalog.section can select elements by section — but not by creation date. For new products block, better to take bitrix:catalog.items (d7-component) or write custom component on top of \Bitrix\Iblock\Elements\ElementTable.
Custom component is in /local/components/vendor/catalog.new/. Structure:
catalog.new/
component.php — selection logic
templates/
.default/
template.php — markup
style.css
script.js
In component.php do selection with cache. Key requirement — tagged cache (\Bitrix\Main\Data\TaggedCache), so when any product in selection changes, block is invalidated, not rest of site.
$taggedCache = \Bitrix\Main\Application::getInstance()->getTaggedCache();
$taggedCache->startTagCache($cacheDir);
$taggedCache->registerTag('iblock_id_' . CATALOG_IBLOCK_ID);
// ... selection ...
$taggedCache->endTagCache();
Performance and Cache
"New Products" block appears on homepage, in section header, on product card — in three places at once. Without cache, that's three identical DB queries per hit. Configure:
-
Component cache — standard
CBitrixComponentmechanism, cache time 3600 seconds - Tagged cache — auto-invalidation on product update via 1C exchange
- Composite cache — if block shows to unauthorized users, it lands in static HTML page cache
Problem with personalization: if site has price groups (retail, wholesale, dealers), new products for each group may differ. In this case cache key includes GROUP_ID of current user, separate cache layer for each group.
Integration with 1C Exchange
If new products managed by creation date or flag exported from 1C — important to check mapping. In CommerceML, creation date can be rewritten on each full exchange, "resetting" all products making them new. Solution: forbid rewriting DATE_CREATE in OnBeforeIBlockElementUpdate handler or configure exchange in "don't rewrite date" mode.
Display: Carousel and Responsiveness
"New Products" block often implemented as horizontal carousel with lazy-load. Load 12–24 products, display 4–6 depending on viewport. For slider initialization use JS wrapper (Swiper.js or custom). Important: product card markup should be identical to one used in catalog — shared template /local/templates/main/components/vendor/catalog.new/.default/item.php. Allows reusing styles and avoiding markup duplication.
"Add to Cart" button in new products block works via AJAX to BXBuy.AddProductToBasket or directly to sale.basket.add REST API (for headless scenarios). Cart counter updates via BX.onCustomEvent('basketUpdated', ...).
Timeline
| Task | Duration |
|---|---|
| Block based on standard component with custom template | 1–2 days |
| Custom component with tagged cache and carousel | 3–4 days |
| + Integration with price groups and personalization | +1–2 days |
| + Agent to auto-remove new flag | +0.5 day |
Final architecture: custom component in /local/, tagged cache, cache key includes user's price group, JS carousel with lazy-load, single product card template. Nothing excessive, works fast, updates automatically.







