Thelia Documentation

website·Indexed 34 days ago

https://doc.thelia.net/

Documentation for Thelia, an open-source e-commerce platform. Includes detailed reference guides for loops in Thelia 3 and Next versions, module development, data access via DataAccessService, and migration guides from Thelia 2 to Thelia 3, including the transition from Smarty to Twig.

Tokens
382.9K
Snippets
1.9K
Records
2.6K
Agent score
63%

What's inside Thelia

  1. Overview of the Flexy front-office theme

    Flexy is the default front-office theme for Thelia 3, implemented as a Symfony bundle (FlexyBundle). It is built using Twig, Symfony UX (Live/Twig Components, Stimulus), AssetMapper, and Tailwind CSS. It provides a complete e-commerce flow (catalog, cart, checkout, account) and handles its own front-office routes, meaning it does not require a separate Thelia module to serve pages.
  2. Overview of Thelia 3 Theme Hooks

    Theme hooks are extension points in a Twig theme that allow modules to inject HTML at fixed locations. Unlike the legacy hook system (which uses BaseHook and database-managed positions), theme hooks are pure code. They are implemented via the ThemeHookInterface and autoconfigured using the thelia.theme_hook tag. The two systems are independent and can be used side-by-side.
  3. Overview of Thelia 3 Back-office (default-twig)

    The Thelia 3 back-office (admin panel) is implemented as a Symfony bundle named default-twig located at templates/backOffice/default-twig/. It uses Twig for templating, Repositories for data fetching, and Twig UiComponents for server-rendered DataTables. Interactivity is handled via Stimulus and Symfony UX (LiveComponent/TwigComponent). The legacy Smarty default back-office theme is deprecated and should not be used for new development.
  4. Overview of Thelia 3 Controller Types

    Thelia provides two base controller types to handle HTTP requests depending on the target area of the application. Both require manual authorization checks via checkAuth() as extending the base class does not automatically secure routes.

    TypeBase ClassTemplate EngineAuthorization Method
    FrontBaseFrontControllerActive front-office template (Flexy / Twig)checkAuth() (no arguments)
    AdminBaseAdminControllerActive back-office template (Twig / default-twig bundle)checkAuth($resources, $modules, $accesses)
  5. Overview of legacy Smarty loops in Thelia 3

    Loops are a legacy data-access mechanism tied to the Smarty templating engine. They are primarily retained for the legacy Smarty default back-office theme and third-party Smarty templates.

    For modern development in Thelia 3, these are NOT recommended:

    • Front-office (Flexy/Twig): Use resources() or the DataAccessService.
    • Twig back-office (default-twig bundle): Use dedicated Repositories (Propel queries) and Twig UI components like DataTable.
  6. Overview of Thelia 3 Back-office Architecture

    The Thelia 3 back-office (admin panel) is implemented as a Symfony bundle named default-twig located at templates/backOffice/default-twig/. It utilizes Twig for templating, Repositories for data fetching, and Twig UiComponents for server-rendered DataTables. Interactivity is handled via Stimulus and Symfony UX (LiveComponent/TwigComponent).

    Note: The legacy Smarty default back-office theme is deprecated and should not be used for new development.

  7. Overview of Back-Office UI Components

    The back-office UI is built using a combination of Symfony UX TwigComponent and Stimulus controllers, targeting Bootstrap 5. All reusable UI components are shipped as part of the default-twig bundle. Components are auto-discovered: any final class in src/UiComponents/ tagged with the #[AsTwigComponent] attribute is automatically registered without needing XML or services.yaml declarations.
  8. Overview of Thelia Theme Hooks

    Theme hooks are extension points in a Twig theme that allow modules to inject HTML at specific locations without the theme needing knowledge of the modules. Unlike the legacy hook system (based on BaseHook and HookRenderEvent), theme hooks are pure code, requiring no database entries or back-office administration. They are implemented via the ThemeHookInterface and are automatically configured through the thelia.theme_hook tag.
  9. Overview of Thelia 3 Back-Office UI Components

    The Thelia 3 back-office uses a component-based architecture based on Symfony UX TwigComponent and Stimulus. All reusable UI elements are part of the default-twig bundle, located in templates/backOffice/default-twig/. Components are auto-discovered via the #[AsTwigComponent] attribute, meaning no XML or global registration is required. To add a new component, place a final class with the attribute in src/UiComponents/ and its corresponding template in components/.
  10. Overview of the Flexy theme for Thelia 3

    Flexy is the default front-office theme for Thelia 3, implemented as a Symfony bundle (FlexyBundle). It is built using Twig, Symfony UX (LiveComponents, TwigComponents, Stimulus), AssetMapper, and Tailwind CSS. It provides a complete e-commerce flow (catalog, cart, checkout, account) and handles its own front-office routes, meaning it depends only on the Thelia core and requires no additional modules to serve pages.
  11. Retrieve cart session data using the {cart} Smarty plugin

    In Thelia 2, the {cart} Smarty plugin substitution allows you to retrieve specific data about the current user's session cart by passing an attr parameter. The plugin returns different values based on the attribute requested, such as item counts, total prices (with or without taxes and discounts), and total weight.
    {cart attr="item_count"}
  12. Understand Thelia data flow

    Thelia uses a domain-layer architecture where templates interact with the API internally.

    Internal Flow: Browser $\rightarrow$ Symfony Router $\rightarrow$ Twig Template $\rightarrow$ DataAccessService $\rightarrow$ API Platform $\rightarrow$ Propel ORM $\rightarrow$ Database.

    External Flow: External clients (such as mobile apps or SPAs) call the same API Platform endpoints over HTTP.