derhaeuptling / regiondo-contao-bundle
Contao开源CMS的区域do插件集成
1.3.3
2019-12-17 22:19 UTC
Requires
- php: ^7.1
- codefog/contao-haste: ^4.20
- contao/calendar-bundle: ^4.4
- contao/core-bundle: ^4.4
- guzzlehttp/guzzle: ^6.3
- kevinrob/guzzle-cache-middleware: ^3.2
- symfony/monolog-bundle: ^3.2
Requires (Dev)
- contao/manager-plugin: ^2.0
- friendsofphp/php-cs-fixer: ^2.2
Suggests
- doctrine/doctrine-cache-bundle: Adds the API request caching, see README for the details
Conflicts
- contao/manager-plugin: <2.0 || >=3.0
README
该插件提供Regiondo与Contao的集成。
目前插件提供以下功能
- Regiondo产品/活动与日历事件的同步。
- Iframe预订小部件内容元素。
- 购物车小部件前端模块。
自定义预订小部件、购物车和结账模块计划在未来推出。
安装
在您的Contao 4项目文件夹中执行以下命令
$ composer require derhaeuptling/regiondo-bundle
然后运行Contao安装工具更新数据库。
配置
安装插件后,将以下配置添加到您的 app/config/config.yml
文件中。
Regiondo密钥可以在Regiondo控制面板的 商店配置 > 网站集成 > API配置
部分获取。
derhaeuptling_regiondo: public_key: 'DE123456789' # The Regiondo public key secure_key: '123456789' # The Regiondo secure key vendor: 'foobar' # The Regiondo vendor name assets_folder: 'files/regiondo_events' # Target folder where event images will be downloaded to sandbox: true # Enable/disable the sandbox mode (optional, defaults to false) debug: '%kernel.debug%' # Enable/disable the debug mode (optional, defaults to false) widget_base_url: 'https://foobar.regiondo.com/' # The custom base URL of the iframe widgets (optional)
通过缓存提高性能
您可以通过添加将处理一些重复API请求的缓存提供程序来提高后端性能。为此,需要 doctrine/doctrine-cache-bundle
依赖关系并调整应用程序的配置
derhaeuptling_regiondo: ... cache_provider: 'doctrine_cache.providers.app_regiondo_cache' ... doctrine_cache: providers: app_regiondo_cache: type: file_system file_system: extension: ".cache" directory: "%kernel.cache_dir%/app/regiondo"
使用URL散列向预订iframe小部件传递值
预订iframe内容元素内的插件可以使用散列预先选择值。这对于您想直接从活动列表或日历视图重定向用户到预订页面特别有用。
您可以将URL散列附加到活动链接,如 event_list
模板的示例所示
… <a href="<?= $this->href ?><?= ($urlHash = \Derhaeuptling\RegiondoBundle\ContentElement\EventBookingIframeElement::generateUrlHash($this->id)) ? ('#' . $urlHash) : '' ?>" …
您还可以通过将第二个参数传递为 false
来禁用散列中的时间
… <?= \Derhaeuptling\RegiondoBundle\ContentElement\EventBookingIframeElement::generateUrlHash($this->id, false) ?> …
使用CRON同步
您可以在服务器上设置CRON,通过执行以下命令定期同步Regiondo数据
$ vendor/bin/contao-console regiondo:sync
该命令还允许同步数据的一些部分
# Synchronize all products
$ vendor/bin/contao-console regiondo:sync products
# Synchronize all calendars
$ vendor/bin/contao-console regiondo:sync calendars
# Synchronize calendars with ID 12, 13, 14
$ vendor/bin/contao-console regiondo:sync calendars --calendars=12,13,14
# Synchronize all reviews
$ vendor/bin/contao-console regiondo:sync reviews
# Synchronize reviews with ID 21,22
$ vendor/bin/contao-console regiondo:sync reviews --reviews=21,22