Um benutzerdefinierte Themenkonfigurationsfelder in Shopware 5 hinzuzufügen, führen Sie die folgenden Schritte aus:
Schritt 1: Gehen Sie zum Shopware-Themenverzeichnis Ihrer Website.
Schritt 2: Klicken Sie auf die Datei Theme.php, um das Konfigurationsfeld hinzuzufügen.

Schritt 3: Fügen Sie den folgenden Code in die Datei Theme.php ein.
use Shopware\Components\Form as Form; //container element
/**
* @param Form\Container\TabContainer $container
*/
public function createConfig(Form\Container\TabContainer $container)
{
// Create the fieldset which is the container of our field
$fieldset = $this->createFieldSet(
'my_custom_settings',
'My custom settings'
);
// Create the textfield
$textField = $this->createTextField(
'basic_font_size',
'Basic font size',
'16px'
);
// Create the color picker field
$colorPickerField = $this->createColorPickerField(
'custom-color-main',
'Main color',
'#62b74b'
);
// Adding the fields to the fieldset
$fieldset->addElement($textField);
$fieldset->addElement($colorPickerField);
// Create the tab which will be named "My custom colors"
$tab = $this->createTab(
'my_custom_tab',
'My custom tab'
);
// add the fieldset to the tab
$tab->addElement($fieldset);
// add the tab to the container, which is a tab panel.
$container->addTab($tab);
}
Schritt 4: Gehen Sie nun zum Themenbereich im Backend und klicken Sie auf das Feld Thema konfigurieren.

Schritt 5: Jetzt sehen Sie die neu erstellte Registerkarte Meine Benutzerdefinition wie im folgenden Screenshot.

Ergebnis:

Bitte kontaktieren Sie uns unter manish@bay20.com oder rufen Sie uns unter +91-8800519180 an, wenn Sie Unterstützung zu Shopware 5 und Shopware 6 benötigen. Sie können auch die Shopware-Entwicklungsseite besuchen, um die von uns angebotenen Dienstleistungen zu prüfen.






