定制 behappy/age-verification-plugin 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

behappy/age-verification-plugin

Composer 安装命令:

composer require behappy/age-verification-plugin

包简介

Provides a way to check customers age in Sylius.

README 文档

README

Provides a way to check customers age in Sylius.

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 :

{# /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.

That's it !

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

Same for creating a customer in the BackOffice.

Configuration

You can redefine the required age by overriding this parameter :

# 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.

Other

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

统计信息

  • 总下载量: 46
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 4
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-01

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固