This documentation is for a version that has reached its End Of Life. Such versions are no longer supported and don't receive security updates. Consider updating to a newer version.
Create custom name schema strategy¶
You can create custom name schema strategy to generate URL aliases based on attribute values. Make sure the attributes are configured correctly. Each attribute that you want to include in the URL alias must have a name schema strategy.
Create converting class¶
Start by creating a PercentNameSchemaStrategy
class, which implements \Ibexa\Contracts\ProductCatalog\NameSchema\NameSchemaStrategyInterface
.
This class is responsible for converting attribute values into a string of URL parameters:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
Register strategy¶
Next, you need to register the strategy in the dependency injection container:
1 2 3 4 5 6 7 8 9 |
|
This ensures that the custom name schema strategy is available for use in generating URL aliases based on attribute values.