pixeldev/sulu-companybundle

Sulu 的公司工具

2.6.0 2024-05-21 15:27 UTC

This package is not auto-updated.

Last update: 2024-09-10 17:19:32 UTC


README

GitHub release (with filter) Dependency

演示

这是一个用于轻松管理公司信息的 Sulu 扩展包。

功能

  • 公司信息管理
  • 手动或自动(通过 Google My Business)时间管理

要求

  • PHP >= 8.0
  • Sulu >= 2.4.*
  • Symfony >= 5.4

安装

安装扩展包

执行以下 composer 命令将扩展包添加到项目的依赖项中

composer require pixeldev/sulu-companybundle --with-all-dependencies

启用扩展包

通过将扩展包添加到项目 config/bundles.php 文件中注册的扩展包列表中来启用扩展包

return [
    /* ... */
    Pixel\CompanyBundle\CompanyBundle::class => ['all' => true],
];

更新模式

bin/console do:sch:up --force

扩展包配置

routes_admin.yaml 中定义管理员 API 路由

company.setting_api:
  type: rest
  prefix: /admin/api
  resource: pixel_company.settings_route_controller
  name_prefix: company.

使用

通用使用

要访问公司设置,在管理界面中,转到“设置”部分并点击“公司管理”。一旦在表单中,填写与您的需求相关/有用的字段。

不要忘记点击“保存”以存储信息并使其可用。

Twig 扩展

此扩展包包含多个 twig 函数,您可以使用这些函数获取之前填写的信息

company_settings():返回公司的所有设置。不需要参数。

使用示例

{% set companySettings = company_settings() %}
<p>{{ companySettings.name }}</p>

get_company_hours():渲染一个显示公司时间的视图(无论它们是如何填写的)。不需要参数。

使用示例

<div id="myHours">
    {{ get_company_hours() }}
</div>

get_google_review():返回平均评分和总评分。不需要参数。

使用示例

{% set ratingInfo = get_google_review() %}
    {% if ratingInfo is not null %}
        <div class="noteGoogle">
            <p>Note : {{ ratingInfo.rating }}</p>
            <ul class="star">
                <li><img src="{{ asset('/assets/images/noteGoogle/star.svg') }}" alt=""></li>
                <li><img src="{{ asset('/assets/images/noteGoogle/star.svg') }}" alt=""></li>
                <li><img src="{{ asset('/assets/images/noteGoogle/star.svg') }}" alt=""></li>
                <li><img src="{{ asset('/assets/images/noteGoogle/star.svg') }}" alt=""></li>
                <li><img src="{{ asset('/assets/images/noteGoogle/star.svg') }}" alt=""></li>
                <li>
                    More than <strong>{{ ratingInfo.total_rating }}</strong> avis
                </li>
            </ul>
        </div>
    {% endif %}

使用 Google My Business

要获取公司通过 Google 的时间,填写地点 ID 和 API 密钥字段,并勾选“使用 Google My Business 中存储的时间?”然后,您需要运行以下命令

bin/console sync:google:informations

这将检索评分、营业时间和可用的总评分数量。

贡献

您可以为此扩展包做出贡献。您必须做的只是遵守我们实施的编码标准。您可以在 ecs.php 文件中找到它们。