juicesweb/sylius-feed-plugin

Sylius电子商务平台内生成feed的插件

资助包维护!
Setono

安装: 1

依赖项: 0

建议者: 0

安全: 0

星标: 0

关注者: 0

分支: 44

类型:symfony-bundle

dev-master / 1.0.x-dev 2023-09-19 22:41 UTC

This package is not auto-updated.

Last update: 2024-10-03 01:38:09 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目录中。