Bitrix AI Challenge — модуль «Избранное»

Implement a Bitrix Wishlist module with ORM storage and encrypted guest cookies.

33|3|Updated Jun 5, 2025
One-click install
npx skills add https://github.com/bxmaximum/bitrix_ai_challenge --skill bitrix-ai-challenge
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Bitrix AI Challenge — модуль «Избранное»
Source: https://github.com/bxmaximum/bitrix_ai_challenge/tree/main/.agents/skills/bitrix-ai-challenge
Command: npx skills add https://github.com/bxmaximum/bitrix_ai_challenge --skill bitrix-ai-challenge

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill encapsulates the Bitrix AI Challenge wishlist module, detailing how to store favorites for authenticated users via ORM and guests via encrypted cookies, plus migration, API, and admin UI requirements to deliver a production-grade solution.

Core Features & Use Cases

  • Storage: authenticated users use a dedicated ORM DataManager table; guests use encrypted cookies.
  • Migration: move guest favorites to DB on user login via OnAfterUserAuthorize; avoid duplicates.
  • REST API: expose POST favorites.add, POST favorites.remove, GET favorites.list, GET favorites.getProducts via \Bitrix\Main\Engine\Controller with proper CSRF and auth checks.
  • Public Component: vendor:favorites.button for add/remove with AJAX, parameterized by PRODUCT_ID, SHOW_COUNTER, and BUTTON_SIZE; responsive UI.
  • Caching & Invalidation: cache wishlist for users; invalidate on IBlock element updates/deletes via tagged cache; events OnAfterIBlockElementDelete and OnAfterIBlockElementUpdate.
  • Admin Settings: module settings page to select catalog info-block, guest cookie TTL, and enable/disable module features.
  • Non-functional: API calls <= 100ms, strong validation, CSRF protection, cookie encryption.

Quick Start

Install and configure the Wishlist module following bitrix_ai_challenge.md, then test via the REST API and the public component.

Frequently Asked Questions about Bitrix AI Challenge — модуль «Избранное»

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I implement a wishlist module in Bitrix that stores guest favorites in cookies and authenticated user favorites in the database?

To implement a Bitrix wishlist, use an ORM DataManager table for authenticated users and encrypted cookies for guests. You must handle data migration upon user login and expose a REST API for list management.

How does Bitrix wishlist migration work when a guest logs in via OnAfterUserAuthorize?

Wishlist migration during OnAfterUserAuthorize moves guest favorites from encrypted cookies into the ORM database table. The process must avoid duplicate entries to ensure a seamless transition for the newly authenticated user.

Does this Bitrix wishlist REST API approach include CSRF protection for favorites.add and favorites.remove endpoints?

Yes, the Bitrix wishlist REST API includes CSRF protection for endpoints like favorites.add and favorites.remove. It uses Bitrix Main Engine Controller with proper authentication checks to secure all list operations.

What's the best way to invalidate Bitrix wishlist cache when catalog items are updated or deleted?

The best way to invalidate Bitrix wishlist cache is using tagged cache. By binding to OnAfterIBlockElementUpdate and OnAfterIBlockElementDelete events, the system automatically clears stale wishlist data when catalog items change.

Can I use Bitrix ORM to build a production-grade wishlist with admin settings and AJAX component integration?

Yes, you can use Bitrix ORM to build a production-grade wishlist. The implementation includes an AJAX-driven public component for add/remove actions and an admin settings page to configure catalog info-blocks and cookie TTL.

Do I need PHP 8.2 and Bitrix 23.x to run a wishlist module with encrypted cookie storage and ORM integration?

Yes, you need PHP 8.2+ and Bitrix 23.x+ to run this wishlist module. These versions provide the necessary framework support for secure encrypted cookie storage, ORM integration, and modern REST API controller features.