Support Form: Storefront
Support Form for Sylius - the form at /support, footer link, notification and confirmation mail, privacy link, overriding the template and the hook for spam protection
Support Form: Storefront
Live Demo: Try this and other plugins live — no installation, no risk: demo.markus-michalski.net
The form in the shop
You reach the form at /support. The route is called mmd_sylius_support_form_plugin_shop_support_request_submit and accepts GET (show the form) and POST (submit). It lives in the shop.yaml file you imported during installation.
The form is built in this order:
- Subject, as a select list or as a free-text field (see Configuration)
- Your extra fields in the order of their position
- The consent to the privacy policy, with or without a link
- The submit button
The consent is mandatory. Without the tick the form reports "You must accept the privacy policy to submit this form." After submitting, the shop redirects back and shows the message "Thank you - your support request has been submitted. I will get back to you as soon as possible." If an extension rejects the request (see Extensibility), the message "Your submission could not be processed. Please try again." appears instead. Both texts come from the plugin translations and can be overridden there.
Logged-in customers
Guests and logged-in customers can submit the form alike. If a customer is logged in and you created a field of type E-mail, the plugin pre-fills the first such field with the customer's address. The customer can change it. The plugin doesn't pre-fill a name because there is no fixed name field.
Footer link
The plugin adds a "Support" link to the help column of the footer (Twig hook sylius_shop.base.footer.content.menu.help_links, priority 50, template shop/help_links/support.html.twig). It deliberately doesn't go into the column with the company information ("About us", "Contact").
If your theme replaces the footer or the help column, the link may not appear there. In that case, link to the route
mmd_sylius_support_form_plugin_shop_support_request_submityourself.
E-mails
After a valid request the plugin sends up to two mails through the Sylius mailer:
| Recipient | Content | |
|---|---|---|
support_request |
The recipient e-mail of the channel configuration, otherwise the channel's contact e-mail | Subject and answers. If a reply address is known, it is set as Reply-To in the header. |
support_request_confirmation |
The address the customer gave | A short receipt that repeats subject and answers ("Your message") so the customer keeps a copy |
The confirmation is only sent if the request has an address. If the channel has neither a recipient e-mail nor a contact e-mail, the notification to you is skipped, but the request is stored. All values from the form are output as text, not as HTML.
You adjust the mail text through copies of these templates under templates/bundles/MmdSyliusSupportFormPlugin/emails/: support_request.html.twig, support_request_confirmation.html.twig and the shared parts _support_request_details.html.twig and _support_request_field.html.twig.
The confirmation goes to any address typed into the form and repeats the details unchanged. Without protection against bots, someone can make your shop send mails with arbitrary text to third parties. See Troubleshooting and FAQ.
Customization
Overriding the template
The form template is located at @MmdSyliusSupportFormPlugin/shop/support_request/index.html.twig and extends the Sylius shop layout. To override it, create a copy at:
templates/bundles/MmdSyliusSupportFormPlugin/shop/support_request/index.html.twig
If your theme ships its own templates, the usual Sylius theme order applies, as for any other bundle template.
The form contains the hook
mmd_altcha.widget.support_formright before the submit button. It is a prepared spot for a spam protection widget. Without an entry registered for it, it renders nothing. If you replace the template, keep this hook if you want to use it.
Hook names at a glance
| Hook | Where | Purpose |
|---|---|---|
sylius_shop.base.footer.content.menu.help_links |
Footer | The plugin adds the support link |
mmd_altcha.widget.support_form |
In the form, before the submit button | Spot for a spam protection widget |
How to place an ALTCHA widget in a custom form through a hook is described in the ALTCHA documentation. The hooks of the admin interface are listed under Extensibility.