The content types allow you to create backend modules that you can use to maintain your own content.
For example, you could create a list with different recipes that shows up in the frontend.
In this article we will show you, the necessary steps to setup your own content types.
To illustrate this even better, you will find a specific example with corresponding screenshots at the end.
Before you can create individual pages and fill them with content, it is necessary to define the basic framework for the pages first.
How to create the basic framework in the backend is described here.
Furthermore, it is possible to provide a content type with your own plug-in - you can find out how to do this in our developer documentation at https://developers.shopware.com/developers-guide/content-types.
To create a content type, first open the module under Configuration > Content Types and click Add item(1).
Please note that the initial assigned name is used for the generation of this link.
You can change the name afterwards, but the technical URL (call via shopware.php) keeps the original structure.
However, the SEO URLs are renamed when the SEO index is rebuilt if the corresponding URL is still available.
The table Seo-URLs (4) shows you the generated Seo-URLs, which you can use to view the pages in the frontend. You define the structure of the Seo-URLs in the Seo-URL template (10).
If you activate the display in the frontend, the entries Title (5), Description (6), Image (7), Meta Title (8) and Meta Description (9) are mandatory. Please note that it is necessary to create corresponding fields first in the Fields area (12) in order to be able to make a selection. You can read more about this in the section Configuring Fields. The search engine robots tag drop-down list (11) allows you to specify whether pages should be indexed or not and whether links on the page should be followed or not.
The label (1) is used to identify the field. It is used in the backend module as a column header (provided Show field as column in backend (6) is active) and in the frontend as a header for the respective block.
You can also define whether this field is required (2).
Type (3) determines which data format is used for the field or what content it can contain.
The (optional) help text (4) is displayed in the backend module. this shows up if you mouse over the blue question mark symbol next to the field. In addition, a support text (5) can be displayed below the respective field. This text, for example, can provide a short explanation of the field.
Especially with more extensive content, the overview in the respective module can become confusing due to the large number of columns, so it is possible not to show field as column in the backend (6). The content of the field can still be maintained normally, but is not displayed in the backend overview.
It is also possible to exclude the content of a field from the search (7) in the respective content module.
For each field it can be configured whether it is translatable (8). This only concerns the contents of the field. The further translation options are described in the section Translation
After you have created your required fields and made the necessary entries in the General tab, you can save the content type. This will create a new entry in the Contents menu now. The entry may only be correctly visible once you have reloaded the backend.
Each content type created provides its own entry in the Contents menu, which is used to maintain the individual contents.
To create a content, click on the Add item button (1), a window opens. This shows the individual fields that you have previously defined while creating the content type.
After you have filled in the individual fields and saved the window, a corresponding content page will be created.
In the frontend you reach the content overview through the url your-shop.com/name-of-the-content-type, a single content page via your-shop.com/name-of-the-content-type/title-of-content.
Please take a look at the example below, this shows the look in detail.
Please note that thumbnails are used to display the images on the detail page of the content. If the images you want to use are stored in an album of the media manager for which no thumbnail sizes have been defined yet, it is necessary to create them.
How to do this is described in the documentation for the Media Manager.
If you create a content type, a new backend module is created in the language that you used. To make the names of the fields available for other languages, snippets are automatically generated when you create a field. Use these to translate the text. The snippets are stored for each content type in a separate subdirectory and you can find them in the snippet administration under Namespaces/backend/custom "nameofmodule".
In addition to the name of the field, you can also change the help and support text here. To translate the entry in the Content menu, the entry CustomNamedesModuls/index is available under backend/index/view/main.
When you create a field for a content type, you can define whether this field can be translated. If you activate this option, the globe symbol will be displayed in the corresponding field, which is also known from other areas in Shopware, and can be used to open the translation module for the field. This makes it possible to create a separate content for each language- or subshop.
In the snippet administration, there is an area that contains the snippets for the created content type. These snippets are similar to the backend translations, however these are for the frontend. This area is named custom"nameofcontenttype" and can be found under Namespace/frontend.
In these snippets you can set things like Meta-Title and Meta-Description.
In addition, you translate the name that is displayed in the frontend on the overview page of the content type. To do this, you need to create another snippet with the name name and define its contents.
Further information on the snippets can be found at https://docs.shopware.com/en/shopware-5-en/settings/snippets
Since settings are made in several places when the content types are used, we would like to explain this with an example.
In this example, we are creating a page with recipes.
The basic module used to create recipes is created and configured via Configuration > Content types. Here you can also specify which data you want to maintain for the recipes and create the corresponding fields.
In the example we use title, description, picture, ingredients and preparation.
After you have done this as described in the section Create a new content type, you can now create the individual recipes. This is possible in the menu Content, here is a new entry with the name of the content type (for example "Recipes") available now. By clicking here you can open the overview of the recipes created and add new recipes. In the window for adding a recipe, you will now see the individual fields that you defined in advance when creating the content type.
The following snippet entries are available for the translations:
backend/index/view/main - CustomRecipes/index for the entry in the Content menu
backend/customrezepte/main contains the snippets for the individual entries within the backend module.
frontend/customrezepte/main provides snippets for adapting meta information in the frontend.
Configuration > Content Types
Content Types > General
Content > Fields
Content > Recipes
Recipes > Details