/SyliusExtendedChannelsPlugin

This plugin provides some extra channel settings in admin.

Primary LanguagePHP

Extended Channels Plugin

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)

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 manGoweb.