setono / sylius-strands-plugin
Plugin that integrates Strands
Installs: 724
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 5
Type:sylius-plugin
Requires
- php: ^7.3
- setono/tag-bag-bundle: ^2.0
- setono/tag-bag-twig: ^1.0
- sylius/sylius: ^1.4
Requires (Dev)
- matthiasnoback/symfony-config-test: ^4.2
- matthiasnoback/symfony-dependency-injection-test: ^4.1
- phpspec/phpspec: ^6.2
- phpunit/phpunit: ^9.2
- roave/security-advisories: dev-master
- setono/code-quality-pack: ^1.2
- setono/sylius-tag-bag-plugin: ^1.1
- symfony/debug-bundle: ^4.4 || ^5.1
- symfony/dotenv: ^4.4 || ^5.1
- symfony/intl: ^4.4 || ^5.1
- symfony/web-profiler-bundle: ^4.4 || ^5.1
This package is auto-updated.
Last update: 2024-11-15 10:49:32 UTC
README
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>