Skip to content

monsieurbiz/SyliusOrderHistoryPlugin

Repository files navigation

Banner of Sylius Order History plugin

Order History for Sylius

Order History Plugin license Tests Status Security Status

This plugin saves order events and allows you to display them in the order history as a timeline. It is based on state machine events.

Demo of the Order History

Installation

Install the plugin via composer:

composer require monsieurbiz/sylius-order-history-plugin

For the installation without flex, follow these additional steps

Change your config/bundles.php file to add this line for the plugin declaration:

<?php

return [
    //..
    MonsieurBiz\SyliusOrderHistoryPlugin\MonsieurBizSyliusOrderHistoryPlugin::class => ['all' => true],
];

Copy the plugin configuration files in your config folder:

cp -Rv vendor/monsieurbiz/sylius-order-history-plugin/recipes/1.0/config/ config

Doctrine migration

In order to create dedicated tables for the plugin, don't forget to execute doctrine migration commands:

bin/console doctrine:migrations:migrate

Getting started

Show any order on the Sylius backend and click on the top right History button.

How does it work?

This plugin is based on the state machine events. It uses the native Winzou state machine callback system to save named order events when they are triggered.

# src/Resources/config/state_machine/checkout.yaml
winzou_state_machine:
  sylius_order_checkout:
    callbacks:
      after:
        monsieur_biz_order_history_notify_address:
          on: 'address'
          do: [ '@MonsieurBiz\SyliusOrderHistoryPlugin\Notifier\OrderHistoryWithAddressesDataNotifier', 'notifyEvent' ]
          args: [ 'object', 'constant("MonsieurBiz\\SyliusOrderHistoryPlugin\\Entity\\OrderHistoryEventInterface::TYPE_CHECKOUT")', '"addressed"' ]

Callback dedicated notifier service / actions who add different details following context:

  • \MonsieurBiz\SyliusOrderHistoryPlugin\Notifier\OrderHistoryNotifier is a basic notifier with no particular details except the given ones as parameters.
  • \MonsieurBiz\SyliusOrderHistoryPlugin\Notifier\OrderHistoryWithAddressesDataNotifier is a notifier dedicated to address events. It adds the billing and shipping address data.
  • \MonsieurBiz\SyliusOrderHistoryPlugin\Notifier\ShipmentOrderHistoryNotifier is a notifier dedicated to shipment events. It adds the shipment method name and the shipment state.
  • \MonsieurBiz\SyliusOrderHistoryPlugin\Notifier\PaymentOrderHistoryNotifier is a notifier dedicated to payment events. It adds the payment method name and the payment state.

How to

Contributing

You can find a way to run the plugin without effort in the file DEVELOPMENT.md.

Then you can open an issue or a Pull Request if you want! 😘
Thank you!

License

This plugin is completely free and released under the MIT License.