Topdata Control Center for Shopware 6
About
This plugin provides a control center for Topdata products.
Installation
Via Composer
composer require topdata/topdata-control-center-sw6
bin/console plugin:refresh
bin/console plugin:install --activate TopdataControlCenterSW6
Manual Installation
- Clone this repository into your Shopware 6
custom/pluginsdirectory:
cd custom/plugins
git clone git@bitbucket.org:topdata/topdata-control-center-sw6.git
- Install and activate the plugin:
bin/console plugin:refresh
bin/console plugin:install --activate TopdataControlCenterSW6
Usage Guide
TODO
this section does not belong into the user manual, but into developer documentation.
Adding as a Dependency
In your plugin’s composer.json:
{
"require": {
"topdata/topdata-control-center-sw6": "^1.0"
}
}
Plugin Registration
For information about registering your plugin with the TopConfigRegistry, see Plugin Registration.
Configuration Types
The TopConfigRegistry supports the following value types:
string: String valuesbool: Boolean valuesint: Integer values
Best Practices
- Always use dot notation for new configuration keys
- Keep configuration mappings in a single location
- Use type-safe getters
- Document your configuration keys
- Handle configuration exceptions appropriately
Plugin Registration
TODO
this section does not belong into the user manual, but into developer documentation.
Register Your Plugin using the provided Compiler Pass
- in the plugin’s main class, register the compiler pass in the
build()method:
private const MAPPINGS = [
'productName' => 'import.product.name',
'productDescription' => 'import.product.description',
'productBrand' => 'import.product.brand',
'productEan' => 'import.product.ean',
// ...
];
public function build(ContainerBuilder $container): void
{
parent::build($container);
// ---- register the plugin in Topdata Configration Center's TopConfigRegistry
if(class_exists(TopConfigServiceCompilerPass::class)) {
$container->addCompilerPass(new TopConfigServiceCompilerPass(__CLASS__, self::MAPPINGS));
}
}
Notes
- The build() method is called when the plugin is loaded by Shopware (e.g. when the plugin is installed or the cache is cleared).
Troubleshooting
TODO
this section does not belong into the user manual, but into developer documentation.
Error Handling
The TopConfigRegistry throws RuntimeException in the following cases:
- Plugin not registered
- Configuration key not found
- Invalid value type requested
Example error handling:
try {
$value = $configService->get('PluginName', 'some.key', 'string');
} catch (RuntimeException $e) {
// Handle the error appropriately
}
Common Issues
- Plugin Not Found: Ensure the plugin is properly registered
- Configuration Not Loading: Check if the mapping is correctly defined
- Type Errors: Verify you’re using the correct type when accessing values
Debug Mode
Enable debug mode in the plugin configuration to get additional logging information.