gally/sylius-plugin

Sylius 连接器用于 Gally


README

需求

  • Gally 版本: 1.3.x
  • Sylius 版本: 1.12.x

用法

  • 安装 gally/sylius-plugin
    • 运行 composer require gally/sylius-plugin
    • config/bundles.php 中添加包。您必须在 SyliusGridBundle 之后放置它
      [...]
      Gally\SyliusPlugin\GallySyliusPlugin::class => ['all' => true],
    • 通过在 config/packages/_sylius.yaml 的导入部分添加以下行来导入 Gally Sylius 包配置
      - { resource: "@GallySyliusPlugin/Resources/config/config.yml" }
    • 通过创建文件 config/routes/gally_admin.yaml 来导入管理路由
      gally_admin:
          resource: "@GallySyliusPlugin/Resources/config/admin_routing.yml"
          prefix: /admin
    • 通过创建文件 config/routes/gally_shop.yaml 来导入商店路由
      gally_shop:
          resource: "@GallySyliusPlugin/Resources/config/shop_routing.yml"
          prefix: /{_locale}
    • 在您的频道实体 src/App/Entity/Channel/Channel.php 中实现 Gally\SyliusPlugin\Model\GallyChannelInterfaceGally\SyliusPlugin\Model\GallyChannelTrait
    <?php
    
    declare(strict_types=1);
    
    namespace App\Entity\Channel;
    
    use Doctrine\ORM\Mapping as ORM;
    use Gally\SyliusPlugin\Model\GallyChannelInterface;
    use Gally\SyliusPlugin\Model\GallyChannelTrait;
    use Sylius\Component\Core\Model\Channel as BaseChannel;
    
     #[ORM\Entity]
     #[ORM\Table(name: 'sylius_channel')]
     class Channel extends BaseChannel implements GallyChannelInterface
     {
        use GallyChannelTrait;
     }
    • 将模板从 vendor/gally/sylius-plugin/src/Resources/views/SyliusShopBundle/ 复制到 templates/bundles/SyliusShopBundle/
    • 复制包的资产(JavaScript 和 CSS 文件)
      • 运行 php bin/console assets:install
      • 运行 php bin/console sylius:install:assets
      • 运行 php bin/console sylius:theme:assets:install
    • 运行 php bin/console doctrine:migrations:diffphp bin/console doctrine:migrations:migrate 来更新数据库模式
    • 打开 Sylius Admin,转到配置 > Gally 并配置 Gally 端点(URL、凭据)
  • 从您的 Sylius 实例运行此命令。此命令必须运行一次以同步结构。
        bin/console gally:structure:sync   # Sync catalog et source field data with gally
  • 从 Sylius 到 Gally 运行完整索引。此命令只能运行一次。之后,修改后的产品将自动同步。
        bin/console gally:index            # Index category and product entity to gally
  • 在此步骤中,您应该能够在 Gally 后端看到您的产品源字段。
  • 它们也应该出现在您的 Sylius 前端中,在搜索或浏览类别时。
  • 完成!
  • 您还可以运行命令来清理 sylius 中不再存在的数据
        bin/console gally:structure:clean 

noUiSlider

此包包括 noUiSlider 的分发文件。noUiSlider 是“一个轻量级、ARIA 可访问的 JavaScript 范围滑块,具有多点触控和键盘支持”,本项目用于实现价格滑块。