Topdata Topdata Docs

TopdataControlCenterSW6

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

  1. Clone this repository into your Shopware 6 custom/plugins directory:
cd custom/plugins
git clone git@bitbucket.org:topdata/topdata-control-center-sw6.git
  1. 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 values
  • bool: Boolean values
  • int: Integer values

Best Practices

  1. Always use dot notation for new configuration keys
  2. Keep configuration mappings in a single location
  3. Use type-safe getters
  4. Document your configuration keys
  5. 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

  1. Plugin Not Found: Ensure the plugin is properly registered
  2. Configuration Not Loading: Check if the mapping is correctly defined
  3. 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.