Skip to content

Plugin that allows customers to reorder previously placed order.

Notifications You must be signed in to change notification settings

webgriffe/CustomerReorderPlugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

188 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

⚠️ BEWARE! This repository has been forked from the official repository because it has been deprecated and will not be maintained or evolved by the Sylius Team.


+

Customer Reorder Plugin

This plugin allows customers to reorder a previously placed order.

Screenshot showing the customer's orders page with reorder buttons

Business value

The plugin allows Customer to reorder any Order that has already been placed. Once a Reorder button is clicked, a new cart filled with items taken from a previously placed order is created. If for some reason Reorder can't be fulfilled completely, the Customer is informed about every circumstance that have affected the Order (i. e. promotion being no longer available or differences in item's prices).

Once the Reorder process is completed, the newly created Order is listed in the history just like any other Orders.

Installation

  1. Run composer require webgriffe/sylius-customer-reorder-plugin: it's normal that the "cache:clear" command, that is executed automatically at the end, fails because you have to do the next steps.

  2. If they have not been added automatically, you have to add these bundles to config/bundles.php file:

    Sylius\CustomerReorderPlugin\SyliusCustomerReorderPlugin::class => ['all' => true],
  3. Add the plugin's configs by creating the file config/packages/webriffe_sylius_customer_reorder_plugin.yaml with the following content:

    imports:
        - { resource: "@SyliusCustomerReorderPlugin/config/config.yaml" }
  4. Add the plugin's routes by creating the file config/routes/webgriffe_sylius_customer_reorder_plugin.yaml with the following content:

    sylius_customer_reorder_plugin:
        resource: "@SyliusCustomerReorderPlugin/config/app_routing.yaml"
  5. Clear cache:

    bin/console cache:clear

Extension points

Customer Reorder plugin is based on two processes:

  • reorder processing
  • reorder eligibility checking

They are both based on Symfony's compiler passes and configured in services.xml file.

ReorderProcessing and EligibilityChecking are independent processes - once a Reorder is created using Processors (services tagged as sylius_customer_reorder_plugin.reorder_processor), the created entity is passed to Eligibility Checkers (services tagged as sylius_customer_reorder_plugin.eligibility_checker).

Hence, both processes can be extended separately by adding services that implement ReorderEligibilityChecker and are tagged as sylius_customer_reorder_plugin.eligibility_checker or implement ReorderProcessor and are tagged as sylius_customer_reorder_plugin.reorder_processor.

Both Reorder button layout and action performed on clicking it are defined in reorder.html.twig template which is declared in config.yml file.

What's more, since Order is a Resource, major part of its configuration is placed in *.yml files. Without using the plugin, Order had Show and Pay actions. Adding Reorder action required extending order-related behaviours in config.yml file.

You can read much more about Resources here: http://docs.sylius.com/en/1.2/components_and_bundles/bundles/SyliusResourceBundle/index.html

Contributing

See CONTRIBUTING.md for contribution guidelines.

About

Plugin that allows customers to reorder previously placed order.

Resources

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 87.1%
  • Gherkin 9.9%
  • Makefile 2.4%
  • Twig 0.6%