2017 © Pedro Peláez
 

sylius-bundle catalog-promotion-plugin

Catalog promotion extension for Sylius.

image

urbanara/catalog-promotion-plugin

Catalog promotion extension for Sylius.

  • Friday, February 2, 2018
  • by akorchaginn
  • Repository
  • 0 Watchers
  • 0 Stars
  • 56 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 12 Forks
  • 0 Open issues
  • 14 Versions
  • 8 % Grown

The README.md

Urbanara Catalog Promotion Plugin License Version Build status on Linux Scrutinizer Quality Score

Plugin provides basic functionality of catalog promotion on a top of Sylius platform, (*1)

Installation

  1. Add plugin to your vendors:
$ composer require urbanara/catalog-promotion-plugin
  1. Extend config files:, (*2)

    1. Import project config:, (*3)

      # app/config/config.yml
      
      imports:
          ...
          - { resource: "@CatalogPromotionPlugin/Resources/config/app/grid.yml" }
      
    2. Import project routing:, (*4)

      # app/config/routing.yml
      ...
      
      urbanara_catalog_plugin:
          resource: "@CatalogPromotionPlugin/Resources/config/routing.yml"
          prefix: /admin
      
    3. Add plugin to AppKernel:, (*5)

      // app/AppKernel.php
      
      $bundles = [
         ...
          new \Urbanara\CatalogPromotionPlugin\CatalogPromotionPlugin(),
      ];
      
      
    4. Extend gulp file with following script:, (*6)

      // Gulpfile.js
      
      gulp.task('catalog-promotion', function() {
          return gulp.src([
              'node_modules/jquery/dist/jquery.min.js',
              'vendor/sylius/sylius/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-prototype-handler.js',
              'vendor/sylius/sylius/src/Sylius/Bundle/UiBundle/Resources/private/js/sylius-form-collection.js',
              'vendor/urbanara/catalog-promotion-plugin/src/Resources/public/**'
          ])
              .pipe(concat('app.js'))
              .pipe(sourcemaps.write('./'))
              .pipe(gulp.dest('web/assets/catalog/' + 'js/'))
              ;
      });
      
      gulp.task('default', ['admin', 'shop', 'catalog-promotion']);
      
  2. To support SyliusElasticSearchPlugin apply the following changes:, (*7)

    1. Configure ONGR in app/config/config.yml:, (*8)

      # app/config/config.yml
      
      ongr_elasticsearch:
          managers:
              default:
                  index:
                      index_name: sylius
                  mappings:
                      CatalogPromotionPlugin:
                          document_dir: ElasticSearch\Document
      
    2. Add required bundles to app/AppKernel.php:, (*9)

      // app/AppKernel.php
      
      $bundles = [
          // ...
          new \Sylius\ElasticSearchPlugin\SyliusElasticSearchPlugin(),
          new \ONGR\ElasticsearchBundle\ONGRElasticsearchBundle(),
          new \ONGR\FilterManagerBundle\ONGRFilterManagerBundle(),
          new \SimpleBus\SymfonyBridge\SimpleBusCommandBusBundle(),
          new \SimpleBus\SymfonyBridge\SimpleBusEventBusBundle(),
      ];
      
      
  3. If you want to see strikeout prices in your shop you need to customize templates on your own. A sample customization is available under tests/Application/app/Resources/SyliusShopBundle, (*10)

Usage

Plugin provides basic crud functionality for catalog promotion as well as processor which will influence unit price of bought items. In addition, a twig helper is provided, which will return a ValueObject with old and current price., (*11)

Plugin supports catalog promotion with start date, ends date, promotion prioritization, custom promotion per channel, exclusive promotions. By default plugin provides two rules which will reduce a number of influenced items and two action. Rules: * Is product - the promotion will be applied only to the products selected in select box. * Is from taxon - the promotion will be applied only to the products which has at least one taxon from selected taxons in select box., (*12)

Actions: * Fixed value action - will reduce the price of product by fixed value. Value is set per channel. * Percentage action - will reduce the price of product by a percentage., (*13)

All features are described in features/ section., (*14)

The Versions