setono/sylius-strands-plugin

集成Strands的插件

安装: 724

依赖者: 0

建议者: 0

安全: 0

星标: 1

关注者: 2

分支: 0

公开问题: 5

类型:sylius-plugin


README

Latest Version Latest Unstable Version Software License Build Status Quality Score

Strands推荐引擎 集成到Sylius中。

安装

步骤 1: 下载插件

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

# Omit setono/sylius-tag-bag-plugin if you want to
# override layout.html.twig as described at https://github.com/Setono/TagBagBundle#usage
$ composer require setono/sylius-strands-plugin setono/sylius-tag-bag-plugin

此命令要求您全局安装Composer,请参阅Composer文档中的安装章节

步骤 2: 启用插件

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

<?php
# config/bundles.php
return [
    Setono\TagBagBundle\SetonoTagBagBundle::class => ['all' => true],

    // Use this bundle or override layout.html.twig as described at https://github.com/Setono/TagBagBundle#usage
    Setono\SyliusTagBagPlugin\SetonoSyliusTagBagPlugin::class => ['all' => true],

    Setono\SyliusStrandsPlugin\SetonoSyliusStrandsPlugin::class => ['all' => true],
];

步骤 3: 创建配置

# config/packages/setono_sylius_strands.yaml
setono_sylius_strands:
    api_id: "%env(STRANDS_API_ID)%"
# .env

# Get it at https://retail.strands.com/account/info/
STRANDS_API_ID=YOUR_API_ID

用法

创建一个通用小部件

在您的twig模板中,您可以使用以下方式插入小部件

{{ strands_widget('template') }}

template 是您从这里获得的ID:strands.com/tpl/website

它将输出以下内容:<div class="strandsRecs" tpl="template"></div>

创建购物车小部件

{{ strands_widget('template')|strands_add_cart_items }}

它将输出以下内容:<div class="strandsRecs" tpl="template" item="当前购物车中的商品列表"></div>

创建产品页面小部件

{{ strands_widget('template')|strands_add_item(product.code) }}

它将输出以下内容:<div class="strandsRecs" tpl="template" item="产品代码"></div>