[{"data":1,"prerenderedAt":28},["ShallowReactive",2],{"$fngtntzawcdkx":3,"$f38h4rgfxzd3qv":21},{"content":4,"package":5,"version":20},"# Configuration\n\nThe plugin's own configuration is a single key. Most of what shapes its behavior is either per-channel data set in the admin, or a service you can swap.\n\n## Bundle Configuration\n\n```yaml\n# config\u002Fpackages\u002Fbabdev_sylius_product_samples.yaml\nbabdev_sylius_product_samples:\n    sample_variant_code_template: 'SAMPLE-{code}'\n```\n\n### `sample_variant_code_template`\n\n**Type:** `string` **Default:** `SAMPLE-{code}`\n\nThe template used to build the code for a generated sample variant. The `{code}` placeholder is replaced with the code of the variant the sample belongs to.\n\n| Template        | Variant code | Generated sample code |\n|-----------------|--------------|-----------------------|\n| `SAMPLE-{code}` | `MUG-BLUE`   | `SAMPLE-MUG-BLUE`     |\n| `{code}-SAMPLE` | `MUG-BLUE`   | `MUG-BLUE-SAMPLE`     |\n| `S-{code}-S`    | `MUG-BLUE`   | `S-MUG-BLUE-S`        |\n| `{code}`        | `MUG-BLUE`   | `MUG-BLUE`            |\n\nThe template must contain the `{code}` placeholder and the container will refuse to compile without it.\n\n## Per-Channel Configuration\n\n### Max Samples Per Order\n\nEach channel carries an optional limit for a maximum number of samples per order. Leaving it empty means the channel has no limit.\n\nThe limit is enforced by a validation constraint mapped onto the `Sylius\\Component\\Core\\Model\\Order` and `Sylius\\Bundle\\OrderBundle\\Controller\\AddToCartCommand` classes in the `sylius` validation group.\n\nSee [Usage](\u002Fopen-source\u002Fpackages\u002Fproduct-samples-plugin\u002Fdocs\u002F1.x\u002Fusage) for how the count is taken.\n\n## Extension Points\n\nEvery collaborator below is defined behind an interface and aliased to its default implementation, so replacing one is a matter of pointing the alias at your own service.\n\n### Sample Variant Code Generation\n\n```php\nnamespace BabDev\\SyliusProductSamplesPlugin\\Generator;\n\ninterface SampleVariantCodeGeneratorInterface\n{\n    public function generate(ProductVariantInterface $sampleVariant): string;\n}\n```\n\nDefault: `TemplateSampleVariantCodeGenerator`, driven by the `sample_variant_code_template` configuration.\n\nImplement this yourself when the template substitution is not enough.\n\n```yaml\nservices:\n    App\\Generator\\MyCodeGenerator: ~\n\n    BabDev\\SyliusProductSamplesPlugin\\Generator\\SampleVariantCodeGeneratorInterface:\n        alias: App\\Generator\\MyCodeGenerator\n```\n\n### Sample Variant Name Generation\n\n```php\nnamespace BabDev\\SyliusProductSamplesPlugin\\Generator;\n\ninterface SampleVariantNameGeneratorInterface\n{\n    public function generate(ProductVariantInterface $sampleVariant, ?string $locale = null): string;\n}\n```\n\nDefault: `TranslatedPrefixSampleVariantNameGenerator`, which renders the `babdev_sylius_product_samples.product_variant.prefixed_sample_name` translation (`Sample - %name%` in English) for each of the variant's locales.\n\nIf you only want to change the wording, override that translation key rather than the service.\n\n### Variant Synchronizers\n\nWhen a sample is generated or updated, two synchronizers copy data from the parent variant onto it:\n\n| Interface                                         | Copies                              |\n|---------------------------------------------------|-------------------------------------|\n| `ProductVariantOptionValuesSynchronizerInterface` | The variant's product option values |\n| `ProductVariantTranslationsSynchronizerInterface` | The variant's translated names      |\n\nReplace either one to change what a sample inherits from its parent.\n\n### Variant Pricing\n\n`SampleAwareProductVariantPricesProvider` decorates Sylius' `sylius.provider.product_variants_prices` service and appends the `sample-price`, `sample-original-price`, and `free-sample` keys to each entry of the variant pricing map that the product show page renders. Because it is a decorator, Sylius' own promotion and original-price handling is untouched, and your own decoration of that service still applies.\n",{"name":6,"slug":7,"description":8,"github":9,"packagistName":12,"packageType":13,"hasDocumentation":14,"supported":14,"visible":14,"versions":15},"Sylius Product Samples Plugin","product-samples-plugin","Adds support for product samples to Sylius applications.",{"owner":10,"repo":11},"BabDev","SyliusProductSamplesPlugin","babdev\u002Fsylius-product-samples-plugin","sylius-plugin",true,[16],{"version":17,"gitBranch":18,"released":19},"1.x","0.1",false,{"version":17,"gitBranch":18,"released":19},{"content":22,"package":23,"version":27},"- [Introduction](\u002Fopen-source\u002Fpackages\u002Fproduct-samples-plugin\u002Fdocs\u002F1.x\u002Fintro)\n- [Installation & Setup](\u002Fopen-source\u002Fpackages\u002Fproduct-samples-plugin\u002Fdocs\u002F1.x\u002Finstallation)\n- [Configuration](\u002Fopen-source\u002Fpackages\u002Fproduct-samples-plugin\u002Fdocs\u002F1.x\u002Fconfiguration)\n- [Usage](\u002Fopen-source\u002Fpackages\u002Fproduct-samples-plugin\u002Fdocs\u002F1.x\u002Fusage)\n",{"name":6,"slug":7,"description":8,"github":24,"packagistName":12,"packageType":13,"hasDocumentation":14,"supported":14,"visible":14,"versions":25},{"owner":10,"repo":11},[26],{"version":17,"gitBranch":18,"released":19},{"version":17,"gitBranch":18,"released":19},1790007747364]