Skip to content

monsieurbiz/SyliusContactRequestPlugin

Repository files navigation

Banner of Sylius Contact Request plugin

Contact Request for Sylius

Contact Request Plugin license Tests Status Recipe Status Security Status

This plugin allows you to customize the contact page on the front-end of your Sylius store. It stores all contact requests made through the native Sylius form in the database, making them accessible directly from the Sylius back office.

Demo of the Contact Request Demo of the Contact Request

Compatibility

Sylius Version PHP Version
1.11 8.0 - 8.1
1.12 8.1 - 8.2
1.13 8.1 - 8.2

Installation

If you want to use our recipes, you can configure your composer.json by running:

composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
composer require monsieurbiz/sylius-contact-request-plugin

Getting started

Contact page customization

Demo of the Contact Request

Contact request storage

Submit a contact request from the native contact form. Them go in the back-office in the customer menu node you will have a new menu 'contact requests', click on it and you can see a grid with the contact requests created. Obviously, this plugin is not retroactive and contact requests made before the plugin was installed will not be displayed.

For the installation without flex, follow these additional steps

Change your config/bundles.php file to add this line for the plugin declaration:

<?php

return [
    //..
    MonsieurBiz\SyliusContactRequestPlugin\MonsieurBizSyliusContactRequestPlugin::class => ['all' => true],
];

Create a new file config/packages/monsieurbiz_sylius_contact_request.yaml and add the following configuration:

imports:
  - { resource: "@MonsieurBizSyliusContactRequestPlugin/Resources/config/config.yaml" }

Create a new file config/routes/monsieurbiz_sylius_contact_request.yaml and add the following configuration:

imports:
    resource: '@MonsieurBizSyliusContactRequestPlugin/Resources/config/routes.yaml'

To override the default sylius route for contact page, create a new file config/routes/sylius_shop_contact_request_override.yaml and add the following configuration:

sylius_shop_contact_request:
    path: /{_locale}/contact
    requirements:
        _locale: ^[A-Za-z]{2,4}(_([A-Za-z]{4}|[0-9]{3}))?(_([A-Za-z]{2}|[0-9]{3}))?$
    methods: [GET, POST]
    defaults:
        _controller: sylius.controller.shop.contact::requestAction
        _sylius:
            redirect: sylius_shop_homepage
            template: '@MonsieurBizSyliusContactRequestPlugin/Shop/ContactRequest/request.html.twig'

This is the same as Sylius route configuration instead of the template key which is overridden to use the plugin template.

Contributing

You can find a way to run the plugin without effort in the file DEVELOPMENT.md.

Then you can open an issue or a Pull Request if you want! 😘
Thank you!

License

This plugin is completely free and released under the MIT License.