For the complete documentation index, see llms.txt. This page is also available as Markdown.

Web Component integration

Web Component integration

Enable or disable web components from the Magento configuration page.

Templates are located in:

src/view/frontend/templates/ff

Module styles are located in:

src/view/frontend/web/css/source/ff
src/view/frontend/web/css/source/_module.less

Magento uses Less for source styles. Integrate templates anywhere in the shop, preferably through Magento layouts.

<referenceBlock name="top.search">
    <action method="setTemplate" ifconfig="factfinder/general/is_enabled">
        <argument name="template" xsi:type="string">Omikron_Factfinder::ff/searchbox.phtml</argument>
    </action>
    <block class="Magento\Framework\View\Element\Template" name="factfinder.suggest" as="suggest" ifconfig="factfinder/general/is_enabled" template="Omikron_Factfinder::ff/suggest.phtml" />
</referenceBlock>

You can instantiate a block through the Magento Layout API. Layout configuration remains the recommended approach.

Communication element

The ff-communication element is defined in src/view/frontend/templates/ff/communication.phtml. Its view model is src/ViewModel/Communication.php.

The default layout adds this template to the after.body.start container. Keep it included. The module cannot work without it.

When the integration is active, the FACT-Finder search box replaces the standard Magento search.

The template is located at:

Searches redirect to the FACT-Finder-powered Magento search results page. FACT-Finder adds relevant details, including the channel and query, to the URL.

The search result layout is defined in:

It includes templates such as ff-record-list for search results.

Request flow and proxy

By default, search and suggest requests go directly to FACT-Finder. Enable the proxy when you need to modify request parameters or responses in Magento.

The proxy controller is located at:

It forwards the request to FACT-Finder, processes the response, then returns it to the frontend. Add an afterExecute plugin to enrich returned data.

Category pages

The module preserves Magento category URLs for SEO. It uses standard Magento routing and custom FACT-Finder search parameters.

When a user opens a category page, a search request starts immediately through the search-immediate communication parameter. Enable the category-pages option in Main Settings.

Tracking

The module tracks these events through the Web Components API:

  • Product clicks

  • Add-to-cart events

  • Completed orders

  • Customer logins

For product clicks, use the data-redirect directive in the record template. Add-to-cart tracking uses src/view/frontend/web/js/catalog-add-to-cart-mixin.js. Keep Magento's base catalog-add-to-cart.js enabled so the mixin applies.

Checkout tracking uses ff-checkout-tracking in src/view/frontend/templates/ff/checkout-tracking.phtml. This template extends the checkout_onepage_success layout. Add it to your own checkout layout if you do not use that layout.

Use src/ViewModel/Order.php to provide the order data. Login tracking uses the ffcommunication customer-data section configured in src/etc/frontend/sections.xml.

Last updated

Was this helpful?