- To install this package with composer, copy the following section to your project's
composer.json
"repositories": [
{
"type": "vcs",
"url": "[email protected]:vladfilimon/sylius-multi-newsletter.git"
}
]
Then do composer require vladfilimon/sylius-multi-newsletter
register the bundle in config/bundles.php
[
...
VladFilimon\MultiNewsletterPlugin\VladFilimonMultiNewsletterPluginBundle::class => ['all' => true],
];
-
Import the routes
# config/routes.yaml sylius_resource: resources: app.multinewsletter: driver: doctrine/orm # You can use also different driver here classes: model: VladFilimon\MultiNewsletterPlugin\Entity\Newsletter
-
Import configuration
# config/packages/_sylius.yaml imports: # ... - { resource: "@VladFilimonMultiNewsletterPluginBundle/Resources/config/config.yml" }
-
Override Sylius' templates
cp -R vendor/vladfilimon/sylius-multi-newsletter/src/Resources/views/bundles/* templates/bundles/
-
Apply migrations
bin/console doctrine:migrations:migrate -n
##Sending newsletters
Because we rely on Sylius mail sender in order to send the newsletters, each new newsletter needs a twig template, and registration for the sylius_mailer.
This bunlde comes with a newsletter template for being subscribed, if you need other templates, register them in sylius_mailer.yaml
like this:
sylius_mailer:
emails:
NEWSLETTER_TEMPLATE_KEY:
template: "path_to_my_template.html.twig"
To send a newsletter you need to run
bin/console newsletter:send NEWSLETTER_ID NEWSLETTER_TEMPLATE_KEY
This provides just minimal functionality. No batch processing, AMQP, no retrying mechanism, semaphores etc.
To run the example sending of newsletter, create a newsletter in the admin, assign some shop users to it (on the admin newsletter edit page) get it's id and run
bin/console newsletter:send NEWSLETTER_ID newsletter_template