Sitecore tips and tricks and community news !

Post Top Ad

Post Top Ad

xCommerce - extend by composition 3/3

So here we are with the next and the last one part of our journey through xCommerce customization path. Now we will take a look on the most proper way to make xCommerce fit to us - composition.



In this way we have to understand how xCommerce solution is build. It has (like Sitecore) own hierarchy flow to process the request. To handle it it uses a few steps:

  • Plugins
  • Controllers and Commands
  • Pipelines
  • Blocks
Let's take a look a bit on them.

 Plugins
  • Independent features
  • Only accepted way to extend Commerce Engine
  • Don’t remove default ones just like that ;)
Controllers & Commands


  • Controllers works in the same way as usuall
  • Commands are invoking inside the controllers
  • Commands invokes Pipelines
 Pipelines


  • You can create your own pipelines and hook into pipelines defined in other plugin
  • Similar to standard Sitecore pipeline mechanism
  • In SXC9 they are in the code not XML
  • Aggregate SXC Blocks
  • Comparing to XML approach No „ShowConfig.ASPX” but JSON preview
  • In Commerce, there is no config patching facilities. Instead we can create our custom plugin and can patch our Blocks through the code.
     
 Blocks



  • Equivalent for Sitecore processors
  • Chaining calls
  • Remember about returning element
Take a look on this examples of adding blocks in a few several ways:



Example

Let's assumme that we have sort of new functionality like subaccounts. To make it work properly we have to add a new controller, command, pipeline and some blocks. To achieve that we have below actions:

  • Controller
  • Command
  • Pipeline
  • Blocks
We also should remember about mentioned earlier registration piplines and blocks in the configuration classes. You will have it also below in the examples of code.
Enjoy!

No comments:

Post a Comment