# Additional fields

From version 3.5.0 it is possible to assign additional fields to the stores.

TIP

Additional fields are not automatically output in the template, but are available as Twig variables.

# Create additional fields

# Create set:

Create a set under Settings > System > Additional Fields. Assign this set to the StoreLocator entity:

Create set

# Create additional fields:

Define the field type and technical name

Create additional fields

# Use additional fields

Use additional fields

The fields now appear in the store and can be filled in.

# Output additional fields

In order to output the additional fields in the frontend, the template must be extended.

In this example, we extend the template of the detail page to include the output of the previously created field ("custom_storelocator_area").

WARNING

Do not overwrite the original template in the plugin - this will be overwritten with the next update.

  • Create a "store_locator" directory in the existing theme in the "custom/plugins/YOURTHEME/src/Resources/views/storefront" directory.
  • Copy the file detail.twig from "custom/plugins/NetiNextStoreLocator/src/Resources/views/storefront/" into the directory "store_locator" of your theme.
  • Edit the file "custom/plugins/DEINTHEME/src/Resources/views/storefront/store_locator/detail.twig".
  • Instead of overwriting the entire file, it makes sense to expand only certain blocks.
  • Replace

    {% sw_extends '@Storefront/store_locator/detail.twig' %}

    with

    {% sw_extends '@Storefront/storefront/store_locator/detail.twig' %}

    • this expands the template
  • Insert

    {{ store.customFields.custom_storelocator_area }}

    in a suitable block. The content is now output in the frontend.

# Output all variables:

Add

{{ dump(page.store) }}

to the template to display all available variables.