setono/sylius-feed-plugin

用于在Sylius电子商务平台中生成feed的插件

资助包维护!
Setono

安装次数: 359,694

依赖关系: 0

建议者: 0

安全性: 0

星标: 24

关注者: 2

分支: 44

公开问题: 23

类型:symfony-bundle

v0.6.19 2024-09-10 10:59 UTC

README

Latest Version Latest Unstable Version Software License Build Status

为任何给定服务创建各种feed的插件。你想为你的Google Merchant center创建产品feed吗?那么这个插件就是为你准备的。

安装

步骤 1: 下载插件

打开命令行,进入你的项目目录,并执行以下命令以下载此插件的最新稳定版本

$ composer require setono/sylius-feed-plugin

此命令要求你已全局安装Composer,如Composer文档中的安装章节所述。

步骤 2: 启用插件

然后,通过将以下内容添加到项目config/bundles.php文件中已注册的插件/包列表中启用插件

<?php

return [
    // ...
    
    League\FlysystemBundle\FlysystemBundle::class => ['all' => true],
    Setono\SyliusFeedPlugin\SetonoSyliusFeedPlugin::class => ['all' => true],
    Setono\DoctrineORMBatcherBundle\SetonoDoctrineORMBatcherBundle::class => ['all' => true],
    
    // It is important to add plugin before the grid bundle
    Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true],
        
    // ...
];

注意 在实例化插件之前必须先实例化网格包,否则您将看到如您请求了一个不存在的参数 "setono_sylius_feed.model.feed.class".之类的异常。

步骤 3: 导入路由

# config/routes/setono_sylius_feed.yaml
setono_sylius_feed:
    resource: "@SetonoSyliusFeedPlugin/Resources/config/routing.yaml"

如果您不使用本地化URL,请使用此路由文件:@SetonoSyliusFeedPlugin/Resources/config/routing_non_localized.yaml

步骤 4: 配置插件

# config/packages/setono_sylius_feed.yaml
imports:
    - { resource: "@SetonoSyliusFeedPlugin/Resources/config/app/config.yaml" }

步骤 5: 更新数据库模式

使用Doctrine迁移来创建迁移文件并更新数据库。

$ bin/console doctrine:migrations:diff
$ bin/console doctrine:migrations:migrate

步骤 6: 使用异步传输(可选,但推荐)

此插件中的所有命令都将扩展CommandInterface。因此,您可以很容易地通过将以下内容添加到您的信使配置来路由所有命令。

# config/packages/messenger.yaml
framework:
    messenger:
        routing:
            # Route all command messages to the async transport
            # This presumes that you have already set up an 'async' transport
            # See docs on how to setup a transport like that: https://symfony.com.cn/doc/current/messenger.html#transports-async-queued-messages
            'Setono\SyliusFeedPlugin\Message\Command\CommandInterface': async

用法

设置完成后,您想要创建一个feed。转到/admin/feeds/new创建一个新的feed。请记住启用它并选择一个或多个渠道。

之后,转到您的控制台并运行此命令

$ php bin/console setono:sylius-feed:process

如果您没有更改任何配置,您的产品feed应该位于/var/storage/setono_sylius_feed/feed目录中。