2017 © Pedro PelĂĄez
 

sylius-plugin age-verification-plugin

Provides a way to check customers age in Sylius.

image

behappy/age-verification-plugin

Provides a way to check customers age in Sylius.

  • Monday, July 16, 2018
  • by Roshyo
  • Repository
  • 4 Watchers
  • 2 Stars
  • 12 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

SyliusAgeVerificationPlugin

Provides a way to check customers age in Sylius., (*1)

Installation-procedure

$ composer require behappy/age-verification-plugin

Enable the plugin

// in app/AppKernel.php
public function registerBundles() {
    $bundles = array(
        // ...
        new \BeHappy\SyliusAgeVerificationPlugin\BeHappySyliusAgeVerificationPlugin(),
    );
    // ...
}
#in app/config/config.yml
imports:
    ...
    - { resource: "@BeHappySyliusAgeVerificationPlugin/Resources/config/app/config.yml" }

Front office

You'll now need to override registration form since the age isn't required by default by Sylius. To do so :, (*2)

{# /app/Resources/SyliusShopBundle/views/Register/_form.html.twig #}
<h4 class="ui dividing header">{{ 'sylius.ui.personal_information'|trans }}</h4>
<div class="two fields">
    {{ form_row(form.firstName) }}
    {{ form_row(form.lastName) }}
</div>
<div class="two fields">
    {{ form_row(form.email) }}
    {{ form_row(form.birthday) }}
</div>
{{ form_row(form.phoneNumber) }}
{{ form_row(form.subscribedToNewsletter) }}
<h4 class="ui dividing header">{{ 'sylius.ui.account_credentials'|trans }}</h4>
{{ form_row(form.user.plainPassword.first) }}
{{ form_row(form.user.plainPassword.second) }}

This is an example, adapt it to your needs., (*3)

That's it !

Now, everytime a customer will try to registrate, the birthday will be required, and must be over 18 (default), (*4)

Same for creating a customer in the BackOffice., (*5)

Configuration

You can redefine the required age by overriding this parameter :, (*6)

# in app/config.yml
parameters:
    ...
    be_happy.age_verification.minimal_age: 21
    ...

Feel free to contribute

You can also ask your questions at the mail address in the composer.json mentioning this package., (*7)

Other

You can also check our other packages (including Sylius plugins) at https://github.com/BeHappyCommunication, (*8)

The Versions