3brs/sylius-extended-channels-plugin

Extended channels plugin for Sylius


README

68747470733a2f2f33627273312e667261312e63646e2e6469676974616c6f6365616e7370616365732e636f6d2f336272732f6c6f676f2f334252532d6c6f676f2d73796c6975732d3230302e706e67

Extended Channels Plugin
68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f336272732f73796c6975732d657874656e6465642d6368616e6e656c732d706c7567696e2e737667 68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f336272732f73796c6975732d657874656e6465642d6368616e6e656c732d706c7567696e2e737667 68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f336272732f73796c6975732d657874656e6465642d6368616e6e656c732d706c7567696e2f6d61737465722e737667
Approved by Sylius

Features

  • Duplicate product and product variant
  • Bulk action to set categories for products
  • Mark Taxon as external link so taxonomy can be used for creating custom menus with links anywhere
  • Download current exchange rates
  • Update product prices using downloaded or custom exchange rates
  • Set channel timezone
  • Set channel phone
  • Send copy of order mail to custom email address per channel
  • When SMTP is unavailable, it prevents error 500 on order submit but logs the error and submits the order
  • Cancel unpaid orders for certain payment method
  • Allows to change the code for the product and product variant
  • Administration for Hello Bars (you can use your own types)

admin.png

Installation

  1. Run $ composer require mangoweb-sylius/sylius-extended-channels.

  2. Add plugin classes to your config/bundles.php:

    return [
       ...
       MangoSylius\ExtendedChannelsPlugin\MangoSyliusExtendedChannelsPlugin::class => ['all' => true],
    ];
  3. Your Entity Channel has to implement \MangoSylius\ExtendedChannelsPlugin\Model\ExtendedChannelInterface. You can use Trait MangoSylius\ExtendedChannelsPlugin\Model\ExtendedChannelTrait.

  4. Your Entity Taxon has to implement \MangoSylius\ExtendedChannelsPlugin\Model\ExternalLinkTaxonInterface. You can use Trait MangoSylius\ExtendedChannelsPlugin\Model\ExternalLinkTaxonTrait.

  5. Include template {{ include('@MangoSyliusExtendedChannelsPlugin/Channel/extendedChannelForm.html.twig') }} in @SyliusAdmin/Channel/_form.html.twig.

  6. Add {{ form_row(form.externalLink) }} to template in @SyliusAdmin/Taxon/_form.html.twig.

  7. Replace inner content of <div class="sylius-grid-nav__bulk"> ... </div> with {{ include('@MangoSyliusExtendedChannelsPlugin/Grid/bulkActions.html.twig') }} in @SyliusAdmin/Grid/_default.html.twig.

  8. Add resource to config/packeges/_sylius.yaml

    imports:
         ...
         - { resource: "@MangoSyliusExtendedChannelsPlugin/Resources/config/resources.yml" }
  9. Add routing to config/_routes.yaml

    mango_sylius_extended_channels:
        resource: '@MangoSyliusExtendedChannelsPlugin/Resources/config/routing.yml'
        prefix: /admin

For guide to use your own entity see Sylius docs - Customizing Models

Optional

Run src/Migrations/basic-data/timezones-data.sql for load the timezones table. (Recommended, otherwise the timezone select will be empty)

Usage

Commands

  • Updates exchange rates (you need to define currencies first in Sylius admin)

    mango:exchange-rates:update
  • Update Product prices by exchange rates, from sourceChannel (primary value, won't be changed) to targetChannel. You can run this after the previous command to update by downloaded rates or you can run it without the previous one to update the prices with your custom exchange rates set in Sylius admin.

    mango:product:update-price sourceChannel targetChannel
  • Remove orders that are not paid for a configured period and for certain shipping methods. This allows to keep unpaid orders which are e.g. to be paid at personal pickup, therefore needs to stay unpaid for a couple of hours / days. Configuration parameters:

    • sylius_order.order_expiration_period
    • sylius_order.expiration_method_codes
    mango:cancel-unpaid-orders
  • You can use events to modify an object when you duplicate it

    • mango-sylius-extended-channels.duplicate.product.before-persist
    • mango-sylius-extended-channels.duplicate.product.after-persist
    • mango-sylius-extended-channels.duplicate.product-variant.before-persist
    • mango-sylius-extended-channels.duplicate.product-variant.after-persist
  • You can use event after bulk category assignment

    • mango-sylius-extended-channels.products.after_bulk_categories
  • You can change the types of Hello bars

    parameters:
        mangoweb_sylius_extended_channels_hello_bar_types:
            error: 'Error'
            success: 'Success'
            info: 'Info'
            warning: 'Warning'
  • Use the Twig function for listing Hello Bars

    • mangoweb_sylius_available_hello_bars()
    • mangoweb_sylius_available_hello_bars_by_type(type)

Development

Usage

  • Create symlink from .env.dist to .env or create your own .env file
  • Develop your plugin in /src
  • See bin/ for useful commands

Testing

After your changes you must ensure that the tests are still passing.

$ composer install
$ bin/console doctrine:schema:create -e test
$ bin/behat
$ bin/phpstan.sh
$ bin/ecs.sh

License

This library is under the MIT license.

Credits

Developed by 3BRS
Forked from manGoweb.