setono/sylius-strands-plugin

Plugin that integrates Strands

Installs: 722

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 2

Forks: 0

Open Issues: 1

Type:sylius-plugin

v1.0.0 2020-08-10 12:53 UTC

This package is auto-updated.

Last update: 2021-05-04 07:23:17 UTC


README

Latest Version Latest Unstable Version Software License Build Status Quality Score

Integrates the Strands recommendation engine into Sylius.

Installation

Step 1: Download the plugin

Open a command console, enter your project directory and execute the following command to download the latest stable version of this plugin:

# 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

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the plugin

Then, enable the plugin by adding it to the list of registered plugins/bundles in the config/bundles.php file of your project:

<?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],
];

Step 3: Create configuration

# 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

Usage

Create a generic widget

In your twig template you can insert a widget like this:

{{ strands_widget('template') }}

The template is the id you get from here: strands.com/tpl/website.

It will output this: <div class="strandsRecs" tpl="template"></div>

Create a widget for the cart

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

It will output this: <div class="strandsRecs" tpl="template" item="list of items in the current cart"></div>

Create a widget for the product page

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

It will output this: <div class="strandsRecs" tpl="template" item="product code"></div>