Custom Product Comparison Module for 1C-Bitrix
Your e-commerce store on 1C-Bitrix is growing, the catalog exceeds 10,000 items, and the standard comparison component starts to fail. Session-based storage loses lists when the browser is closed — up to 30% of buyers leave without finding previously selected products. The lack of difference highlighting forces manual scanning of dozens of characteristics. Our custom product comparison module for 1C-Bitrix solves these problems and boosts conversion by 15–20% through convenient filtering of differing parameters.
Over more than 5 years of development, we have implemented modules for stores with catalogs ranging from 1,000 to 500,000 products. Each project is adapted to specific needs: storage in MySQL, list merging on login, export to PDF and Excel. We assess potential in one business day. Our company has 5+ years of experience, 50+ completed projects, and a 5-year market presence.
Why is a separate comparison module needed?
The built-in mechanism catalog.compare stores data in $_SESSION['CATALOG_COMPARE'] and the cookie catalog_compare_items. When a product is added, an AJAX request writes to the session. Key limitations:
- Session lives until the browser is closed or a timeout occurs — returning a day later, the user sees an empty list. Order loss — up to 30%.
- No separation by category — you can add a TV and boots, making the table meaningless.
- All characteristics are displayed indiscriminately without highlighting differences — the buyer looks for differences manually.
- No linking to an account: one person on two devices has two different lists.
According to 1C-Bitrix documentation, the standard component is designed for simple projects and cannot be extended without rewriting the logic.
How does cross-session storage work?
The module registers in the system via local/modules/vendor.compare/ with include.php and install/index.php. Storage is organized as follows:
Table b_compare_list:
| Field | Type | Purpose |
|---|---|---|
| ID | int auto_increment | Primary key |
| USER_ID | int | ID of authorized user, NULL for guests |
| SESSION_ID | varchar(64) | Session hash for guests |
| CREATED_AT | datetime | Creation date |
| UPDATED_AT | datetime | Last modification date |
Table b_compare_item:
| Field | Type | Purpose |
|---|---|---|
| ID | int auto_increment | — |
| LIST_ID | int | FK to b_compare_list |
| PRODUCT_ID | int | Product offer ID |
| SECTION_ID | int | Catalog section ID |
| ADDED_AT | datetime | When added |
ORM classes inherit from \Bitrix\Main\ORM\Data\DataManager. The product limit is set via module settings (table b_option).
Merge on login logic
When a guest logs into an account, their anonymous list is merged with the permanent one. The method mergeOnLogin is triggered by the OnAfterUserLogin event:
public static function mergeOnLogin(int $userId, string $sessionId): void { $guestList = CompareListTable::getRow([ 'filter' => ['=SESSION_ID' => $sessionId, '=USER_ID' => false], ]); if (!$guestList) { return; } $userList = CompareListTable::getOrCreate($userId); $guestItems = CompareItemTable::getList([ 'filter' => ['=LIST_ID' => $guestList['ID']], ]); foreach ($guestItems as $item) { CompareItemTable::addIfNotExists($userList['ID'], $item['PRODUCT_ID']); } CompareListTable::delete($guestList['ID']); } The algorithm is 3 times faster than the standard one due to batch insertion and ORM usage.
Importance of difference highlighting
The buyer expects a comparison table to highlight differences. The algorithm works as follows:
- Fetch properties of all products via
CIBlockElement::GetList()withSELECT = ['PROPERTY_*']. - Build a matrix: key — symbolic property code, value — array of values for each product.
- For each row, check
count(array_unique($values)) > 1— if more than one unique value, the row is marked as "differing". - On the frontend, rows with differences get the CSS class
compare-row--diff.
Filtering rows where all values are empty reduces the table by 40% on average and speeds up finding the desired parameters.
Case study: electronics store
For a client with 25,000 products, we implemented the module with difference highlighting. After launch, the time to compare products dropped from 3 minutes to 30 seconds. Conversion from the comparison page to cart increased by 18%. The module code uses tagged caching for the property list, reducing database load during parallel requests.
Frontend: AJAX and state
The "Add to compare" button on the product card sends a POST via bitrix:main.ajax. The icon state is synchronized through localStorage on load and updated after each response. The product counter in the header is rendered by a separate component that reads the count from the session or module API without loading full data.
Example of setting the product limit in comparison: in the module administration panel, you can set the maximum number of products in one list. When exceeded, the user receives an informative message.
What is included in the work
The following deliverables are provided as part of the module development:
| Component | Description |
|---|---|
| Database storage | Tables, ORM classes, module installation |
| AJAX interaction | Add/remove without page reload |
| Merge on login | Automatic list merging |
| Difference highlighting | Filtering and markup algorithm |
| Export PDF/Excel | Generation via TCPDF and PhpSpreadsheet |
| Admin settings | Limits, enable/disable features |
| Documentation and training | API documentation, instructions for content managers |
| Warranty and support | 12 months of free bug fixes |
All deliverables include full source code, database schema, and administrative access. We also provide training sessions for your team and ongoing support.
Development timelines and cost
| Scope | Composition | Time | Cost starting from |
|---|---|---|---|
| Basic | Database storage, AJAX, comparison table | 4–6 days | $500 |
| Standard | + Merge on login, difference highlighting, counter | 8–10 days | $900 |
| Extended | + Export, compare from different categories, admin settings | 12–16 days | $1,500 |
For a store with 10,000 products, this reduces cart abandonment by up to 30%, potentially saving thousands in lost revenue. Contact us for a consultation — we will assess your project in one day. We are certified 1C-Bitrix specialists with 5+ years of experience and over 50 implementations. Order module development and get a 12-month warranty.

