setono / sylius-shop-the-look-plugin
Create looks for your Sylius store that let your customers buy more items
Installs: 10 404
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 3
Forks: 0
Open Issues: 6
Type:sylius-plugin
Requires
- php: >=7.4
- doctrine/collections: ^1.6
- doctrine/orm: ^2.7
- knplabs/knp-menu: ^3.1
- sylius/resource-bundle: ^1.6
- symfony/config: ^4.4 || ^5.0
- symfony/dependency-injection: ^4.4 || ^5.0
- symfony/form: ^4.4 || ^5.0
- symfony/http-foundation: ^4.4 || ^5.0.7
- symfony/intl: ^4.4 || ^5.0
- symfony/options-resolver: ^4.4 || ^5.0
- symfony/templating: ^4.4 || ^5.0
- twig/twig: ^2.14
- webmozart/assert: ^1.9
Requires (Dev)
- friendsofphp/proxy-manager-lts: ^1.0
- fzaninotto/faker: ^1.9
- matthiasnoback/symfony-config-test: ^4.2
- matthiasnoback/symfony-dependency-injection-test: ^4.2
- phpspec/phpspec: ^7.1
- phpunit/phpunit: ^9.5
- psalm/plugin-phpunit: ^0.16.1
- psalm/plugin-symfony: ^3.0
- roave/security-advisories: dev-latest
- setono/code-quality-pack: ^2.1.2
- sylius/sylius: ~1.7.11
- symfony/debug-bundle: ^5.1
- symfony/dotenv: ^5.3
- symfony/web-profiler-bundle: ^5.0
- symfony/web-server-bundle: ^4.4 || ^5.0
- symfony/webpack-encore-bundle: ^1.7
README
Installation
Require plugin with composer
composer require setono/sylius-shop-the-look-plugin
Import configuration
# config/packages/setono_sylius_shop_the_look.yaml imports: - { resource: "@SetonoSyliusShopTheLookPlugin/Resources/config/app/config.yaml" }
(Optional) Import fixtures
If you wish to have some looks to play with in your application during development.
# config/packages/setono_sylius_shop_the_look.yaml imports: # ... - { resource: "@SetonoSyliusShopTheLookPlugin/Resources/config/app/fixtures.yaml" }
Import routing
# config/routes/setono_sylius_shop_the_look.yaml setono_sylius_shop_the_look: resource: "@SetonoSyliusShopTheLookPlugin/Resources/config/routes.yaml" # Or if your app doesn't use localized URLs: # resource: "@SetonoSyliusShopTheLookPlugin/Resources/config/routes_no_locale.yaml" # @see https://docs.sylius.com/en/latest/cookbook/shop/disabling-localised-urls.html
Add plugin class to your bundles.php
Make sure you add it before SyliusGridBundle
, otherwise you'll get exception.
<?php $bundles = [ // ... Setono\SyliusShopTheLookPlugin\SetonoSyliusShopTheLookPlugin::class => ['all' => true], Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], // ... ];
Prepare assets
If you're using Webpack encore in your app:
- Add swiper to your
package.json
:
yarn add swiper
- Specify plugin's scripts alias at
webpack.config.js
:
// webpack.config.js // Admin const setonoShopTheLookPluginAdminResources = path.resolve(__dirname, 'vendor/setono/sylius-shop-the-look-plugin/src/Resources/private/admin/'); // ... adminConfig.resolve.alias['setono/shop-the-look-plugin'] = setonoShopTheLookPluginAdminResources; // ... // Shop const setonoShopTheLookPluginShopResources = path.resolve(__dirname, 'vendor/setono/sylius-shop-the-look-plugin/src/Resources/private/shop/'); // ... shopConfig.resolve.alias['setono/shop-the-look-plugin'] = setonoShopTheLookPluginShopResources;
- Use plugin's apps/styles:
// assets/admin/js/app.js import 'setono/shop-the-look-plugin/js/app';
// assets/shop/js/app.js import 'setono/shop-the-look-plugin/js/app'; import 'setono/shop-the-look-plugin/scss/app';
- And run
yarn encore dev
to rebuild it
If you're using regular scripts inclusion
This is not supported out of the box (slug generation script), but I guess you can do something like this at your app's javascript file:
(function ($) { 'use strict'; $.fn.extend({ // Put setono-shop-the-look-slug.js's content here }); $(document).ready(() => { $(document).lookSlugGenerator(); }); })(jQuery);
# config/packages/setono_sylius_shop_the_look.yaml imports: // ... - { resource: "@SetonoSyliusShopTheLookPlugin/Resources/config/app/ui/admin.yaml" }
Also, you should discover src/Resources/private and adjust shop styles/scripts to your needs.
Update your database:
$ bin/console doctrine:migrations:diff $ bin/console doctrine:migrations:migrate
Override templates
Inject look discount lines from src/Resources/views/templates/bundles templates to cart/checkout/order templates like it was done at tests/Application/templates/bundles.