<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Arif</title>
    <description>The latest articles on DEV Community by Arif (@mdarifuzzaman).</description>
    <link>https://dev.to/mdarifuzzaman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F321031%2F49464228-7ffb-4301-9609-444b92da1f54.png</url>
      <title>DEV Community: Arif</title>
      <link>https://dev.to/mdarifuzzaman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mdarifuzzaman"/>
    <language>en</language>
    <item>
      <title>How to install Habitat in Sitecore 9.2 platform</title>
      <dc:creator>Arif</dc:creator>
      <pubDate>Tue, 04 Feb 2020 22:08:19 +0000</pubDate>
      <link>https://dev.to/mdarifuzzaman/how-to-install-habitat-in-sitecore-9-2-platform-475p</link>
      <guid>https://dev.to/mdarifuzzaman/how-to-install-habitat-in-sitecore-9-2-platform-475p</guid>
      <description>&lt;p&gt;Hi Guys,&lt;/p&gt;

&lt;p&gt;Instead of writing, i have posted this video to understand how to install sitecore habitat on top of sitecore 9.2.&lt;/p&gt;

</description>
      <category>sitecore</category>
      <category>sitecorecms</category>
      <category>habitat</category>
      <category>sitecore92</category>
    </item>
    <item>
      <title>Sitecore Commerce - Pipeline and Block</title>
      <dc:creator>Arif</dc:creator>
      <pubDate>Sat, 25 Jan 2020 03:51:41 +0000</pubDate>
      <link>https://dev.to/mdarifuzzaman/sitecore-commerce-pipeline-and-block-2eo6</link>
      <guid>https://dev.to/mdarifuzzaman/sitecore-commerce-pipeline-and-block-2eo6</guid>
      <description>&lt;h4&gt;Introduction &lt;/h4&gt; Pipelines are the extension point of Sitecore and Sitecore Commerce. Although there is a difference in terms of how we implement from Sitecore to Sitecore Commerce. 

&lt;h4&gt;Difference between Sitecore and Sitecore Commerce &lt;/h4&gt;

&lt;p&gt;In Sitecore, we register pipelines in Configuration files. We then register processors in those pipelines. There is no configuration approach in Commerce for pipelines. We need to register pipelines in code and then we can attach blocks in those pipelines. In Sitecore XM/XP, each of the processors has a PipelineArgs from where we can pass our data to the next processor whereas, in Commerce, the returned result of the first block will be used as an input to the next Block and so on. &lt;/p&gt;

&lt;h4&gt;Seriously, there is no config? then how to patch (i.e replace, after, before) &lt;/h4&gt;

&lt;p&gt;Let me give you couple of examples:&lt;/p&gt;

&lt;h3&gt;Example 1, Adding a new pipeline with a single block &lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;ConfigureServices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IServiceCollection&lt;/span&gt; &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;assembly&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Assembly&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetExecutingAssembly&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RegisterAllPipelineBlocks&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;assembly&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
     &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sitecore&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Pipelines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
             &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddPipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IMemberDiscountPipeline&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;MemberDiscountPipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;configure&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;{&lt;/span&gt;
                            &lt;span class="n"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MemberDiscountBlock&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
                        &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="p"&gt;);&lt;/span&gt;
 &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;




&lt;h3&gt;Example 2 &lt;/h3&gt; We are adding a block to a existing pipeline (ICalculateCartPipeline)&lt;br&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;
      &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;ConfigureServices&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;IServiceCollection&lt;/span&gt; &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;assembly&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Assembly&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;GetExecutingAssembly&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
            &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;RegisterAllPipelineBlocks&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;assembly&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

            &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sitecore&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Pipelines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
             &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ConfigurePipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ICalculateCartPipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;configure&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
                    &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="n"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;CalculateDiscountBlock&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
                    &lt;span class="p"&gt;})&lt;/span&gt;
                        &lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;Example 3 &lt;/h3&gt; We are now replacing a block with our own block:&lt;br&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;
&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sitecore&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Pipelines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
             &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ConfigurePipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IMemberDiscountPipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;configure&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
                    &lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="n"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Replace&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MemberDiscountBlock&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;NewMemberDiscountBlock&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
                    &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;Example 4 &lt;/h3&gt; We are now adding our own block a block after/before a certain block:&lt;br&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;
&lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sitecore&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Pipelines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
             &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ConfigurePipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IAddCartLinePipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;configure&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;{&lt;/span&gt;
                            &lt;span class="n"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;SpecialDiscountBlock&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;().&lt;/span&gt;&lt;span class="n"&gt;Before&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ICalculateCartPipelineBlock&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
                        &lt;span class="p"&gt;})&lt;/span&gt;
                        &lt;span class="p"&gt;);&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Pretty easy and cool, right? It's really important to know how many pipelines and blocks are there in the Commerce System and how they work together. In Sitecore, we have "showconfig.aspx" where we can see all of them together. But in Commerce, there is no such thing but a log where we can see. It's called node configuration. If we explore the commerce hosting directory, we will have a log in the following path: "wwwroot/log/NodeConfiguration_Deployment.....log". If we explore this file, we will see something like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--82up4AhA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/n66hu4iuww6ucqj90xkq.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--82up4AhA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/n66hu4iuww6ucqj90xkq.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3lsSGZXV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/m52iffdsb291ybpurk2s.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3lsSGZXV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/m52iffdsb291ybpurk2s.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This file should contain all of the registered (including your's one) with all the blocks associated with the pipelines.&lt;/p&gt;

&lt;h4&gt;How Sitecore Commerce Solution uses pipelines &lt;/h4&gt;

&lt;p&gt;Sitecore commerce already provides core pipelines and blocks. We just need to use them and as necessary we might need to add blocks to them and sometimes obviously we will need to create our own pipeline and we can push that to an existing pipeline. (&lt;b&gt;A pipeline can hold not only blocks but also pipelines &lt;/b&gt;)&lt;/p&gt;

&lt;h4&gt;Conclusion &lt;/h4&gt;

&lt;p&gt;I hope now it's clear what is Commerce Pipeline and Block. I will use them to create our own feature in Commerce in my later articles. I will publish an article about the implementation of Pipeline and Block to solve a simple business problem in my next article.&lt;/p&gt;

</description>
      <category>sitecore</category>
      <category>block</category>
      <category>sitecorecommerce</category>
      <category>pipeline</category>
    </item>
    <item>
      <title>Sitecore - Add custom button in Launchpad</title>
      <dc:creator>Arif</dc:creator>
      <pubDate>Thu, 23 Jan 2020 11:42:50 +0000</pubDate>
      <link>https://dev.to/mdarifuzzaman/sitecore-add-custom-button-in-launchpad-18e5</link>
      <guid>https://dev.to/mdarifuzzaman/sitecore-add-custom-button-in-launchpad-18e5</guid>
      <description>&lt;h4&gt;Introduction &lt;/h4&gt; Today I am going to show you how to add a custom launch button in the launchpad of Sitecore. It is quite straightforward for the Sitecore expert. If you find it so silly, you might skip this article.

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Plz8xt1S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/89wzdat5tysuoyye2nmj.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Plz8xt1S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/89wzdat5tysuoyye2nmj.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h4&gt;Adding Launch Button &lt;/h4&gt; Button and other core stuffs are part of Sitecore Core database. The easiest way is, go to "Content Editor" in core. I always use "sc_content=core" query string in Content Editor URL. 

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---Y0eqJGs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/l7hbqg09set2i5wq187o.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---Y0eqJGs--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/l7hbqg09set2i5wq187o.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go to &lt;b&gt; "/sitecore/client/Applications/Launchpad/PageSettings/Buttons/" &lt;/b&gt;&lt;br&gt;
You will see there is a group as below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9GBy_s7m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3454p4minnotkna57su2.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9GBy_s7m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/3454p4minnotkna57su2.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, right click any of the groups and select "Insert - Launch-Button".&lt;br&gt;
You can then fill the button item property as you need as below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BMTRbymP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/d689f389lr6hjfcz1x3a.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BMTRbymP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/d689f389lr6hjfcz1x3a.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Text &lt;/b&gt;: The text you want to display in the Launchpad button&lt;br&gt;
&lt;b&gt;Open Icon &lt;/b&gt;: You can select a icon from the thousands of icon options.&lt;br&gt;
&lt;b&gt;Link &lt;/b&gt;: You application link. If it's Sitecore Item, then you can use item path as shown in the image above&lt;br&gt;
&lt;b&gt;Open in new tab &lt;/b&gt;: If you want your application to be opened in a separate tab&lt;br&gt;
&lt;b&gt;Open in frame &lt;/b&gt;: If you want your application to be opened in a iframe.&lt;/p&gt;

&lt;p&gt;That's all. Hope you now will create your own Launch button as discussed here. Let me know your thoughts&lt;/p&gt;

&lt;p&gt;Arif&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/mdarifuzzaman/"&gt;https://www.linkedin.com/in/mdarifuzzaman/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sitecore</category>
      <category>launchpad</category>
      <category>button</category>
      <category>howto</category>
    </item>
    <item>
      <title>Sitecore Commerce - Entity-Component-Policy</title>
      <dc:creator>Arif</dc:creator>
      <pubDate>Wed, 22 Jan 2020 08:15:36 +0000</pubDate>
      <link>https://dev.to/mdarifuzzaman/sitecore-commerce-entity-component-policy-50pa</link>
      <guid>https://dev.to/mdarifuzzaman/sitecore-commerce-entity-component-policy-50pa</guid>
      <description>&lt;p&gt;Previous Article&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;a href="https://dev.to/mdarifuzzaman/sitecore-commerce-introduction-59k5"&gt;Introduction to Sitecore Commerce&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Sitecore Commerce - Entity-Component-Policy&lt;/h4&gt;

&lt;p&gt;Those who are just landing in this article, please complete the earlier article to grab the context from the above list. &lt;/p&gt;

&lt;p&gt;We need to first understand what is an entity in Sitecore Commerce. This is the very primary terms to know. In a simple definition, we can say, the entity is an object which encapsulates a cart and all its behavior. An entity is stored in a database as a serialized object.&lt;/p&gt;


&lt;h4&gt;Getting familiar with entity: &lt;/h4&gt; Let me show you a sample entity as below

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--RTJUP3E7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jnat587g7ckfn8v98bo8.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RTJUP3E7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/jnat587g7ckfn8v98bo8.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me elaborate on this object a bit although it's kind of self-explanatory.&lt;/p&gt;


&lt;li&gt;ShopName : &lt;/li&gt; It is your shop. Every commerce system is based on a shop. We can configure multiple shops in a single commerce server that's why each of the API calls, this information must be passed through. (We will see that in my later article)


&lt;li&gt;Item Count : &lt;/li&gt; Total number of item in the cart


&lt;li&gt;Lines: &lt;/li&gt; How many line (product) do you have in the cart. 


&lt;li&gt;Adjustment: &lt;/li&gt; If cart has any adjustment (Discount)


&lt;li&gt;Components: &lt;/li&gt; Components can be Cart level or Line level. This is one of the extension points of our cart entity. It requires a bit of explanation below.


&lt;h4&gt;Components: &lt;/h4&gt; As I said before, this is an extension point of a Cart. It is a list. The number of Components varies based on Cart behavior or property. We can add or remove components based on the different behavior of the cart. Sample example is:

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--akSUkCwW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/co9agj9uvfwk81yh5gkj.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--akSUkCwW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/co9agj9uvfwk81yh5gkj.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see, this cart entity has 3 components (I only expanded one). The easiest way to create a component is as follow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;namespace&lt;/span&gt; &lt;span class="nn"&gt;Plugin.Sample.AdventureWorks.Components&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LogComponent&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Component&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Message&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;ErrorCode&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If we need to extend anything in the cart level, we will create Component as above and will add that to Cart -&amp;gt; Components. Now, the "Lines" object from the above image is also a component that has a list of CartLineComponent. The CartLineComponent is also extended from Component and includes some extra properties as necessary. We can place components as a nested way as well. &lt;/p&gt;

&lt;p&gt;Let's expand the Lines object from cart entity and see component is being used there:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m_aYhmj7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wdu0edkd3buapgoy55hc.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m_aYhmj7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/wdu0edkd3buapgoy55hc.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I expanded one of the lines and found "ChildComponents" array (Each line is a component therefore it says ChildComponent). It also stores the same component object. And obviously it is also the extension point of your lines. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iih7Fizi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/xvzp4qzazbzra4hw75ur.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iih7Fizi--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/xvzp4qzazbzra4hw75ur.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can see, it has a product information component that holds all the information about your product of that line along with some other components. &lt;br&gt;
Now if you have any particular business requirement i.e to store some extra information about the product or maybe we want to display an extra message for delivery of this product or anything, we can create components and store that information. Now the benefit we are going to get here is, that particular information will be saved in the database as part of the cart entity which can be retrieved (deserialized) later on and can be used.&lt;/p&gt;


&lt;h4&gt;Policy: &lt;/h4&gt; Policy is a part of Component and will define extra behavior or rights.  Let me give you an idea. If we see, the Line component doesn't have any pricing information. Then how will the price be calculated? Well, pricing is a very variable thing and it's not a good idea that your product will carry that property. Rather, there will be a policy that will carry pricing information.&lt;br&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"Policies"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"$type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"System.Collections.Generic.List`1[[Sitecore.Commerce.Core.Policy, Sitecore.Commerce.Core]], mscorlib"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="nl"&gt;"$values"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="nl"&gt;"$type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Sitecore.Commerce.Plugin.Pricing.PurchaseOptionMoneyPolicy, Sitecore.Commerce.Plugin.Pricing"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="nl"&gt;"SellPrice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
                                &lt;/span&gt;&lt;span class="nl"&gt;"$type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Sitecore.Commerce.Core.Money, Sitecore.Commerce.Core"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                                &lt;/span&gt;&lt;span class="nl"&gt;"CurrencyCode"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"USD"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                                &lt;/span&gt;&lt;span class="nl"&gt;"Amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mf"&gt;535.0&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="nl"&gt;"FixedSellPrice"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="nl"&gt;"Expires"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"2020-01-03T00:23:02.1622096+00:00"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
                            &lt;/span&gt;&lt;span class="nl"&gt;"PolicyId"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"f7bfaa51df064886923450a6ca5d17f3"&lt;/span&gt;&lt;span class="w"&gt;
                        &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
                    &lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
                &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="err"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Have a look at the above. Policies array is part of each product line. Now, PurchaseOptionMoneyPolicy will give you the selling price. If based on any business cases, we need to give a special price for a special product, we can use a different custom pricing policy instead.&lt;/p&gt;

&lt;p&gt;Another example would be, you need to get the price from an external system i.e your own inventory system may be (which is not a Sitecore system). You might store a new policy that will hold all the information to talk to that server like Server URL, AuthKey, ProductId whichever are required we can store and that way we can extend the behavior of our components.&lt;/p&gt;

&lt;p&gt;Creating a Policy is pretty easy. What you need to do is below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;RedisCachePolicy&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Policy&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Connection&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="n"&gt;Timeout&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Here you can see we have created a policy to define the cache behavior. So for any reasons if we want our line will be cached somewhere in Redis, we can do that.&lt;/p&gt;

&lt;p&gt;The only thing we need to know before implementing a commerce solution is different commerce environments. Next article I will cover :&lt;/p&gt;

&lt;p&gt;&lt;b&gt; What is Sitecore Commerce environment and will explain Shops, Authoring and Minions environment briefly&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Till then bye,&lt;br&gt;
Arif&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/mdarifuzzaman/"&gt;https://www.linkedin.com/in/mdarifuzzaman/&lt;/a&gt;&lt;br&gt;
channel: &lt;a href="https://www.youtube.com/channel/UCNV_WMRXkq6E4EojTX8XJPw"&gt;https://www.youtube.com/channel/UCNV_WMRXkq6E4EojTX8XJPw&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sitecore</category>
      <category>sitecorecommerce</category>
      <category>sitecorecommerce92</category>
      <category>entity</category>
    </item>
    <item>
      <title>Sitecore Identity Server</title>
      <dc:creator>Arif</dc:creator>
      <pubDate>Tue, 21 Jan 2020 23:54:00 +0000</pubDate>
      <link>https://dev.to/mdarifuzzaman/sitecore-identity-server-2hbf</link>
      <guid>https://dev.to/mdarifuzzaman/sitecore-identity-server-2hbf</guid>
      <description>&lt;h4&gt; Introduction &lt;/h4&gt;

&lt;p&gt;Sitecore 9 onward introduces headless capabilities of Sitecore which means we can now access Items via Sitecore Services Client API (Aggregate) which is basically a odata API. Those who want to know details about it, you will find it &lt;a href="https://doc.sitecore.com/developers/90/sitecore-experience-manager/en/the-odata-item-service.html"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I was actively working as a member of Sitecore Services Client team while we shipped that with Sitecore 9 in 2017. The aim was to support multiple platforms to work with Sitecore. As an example is, people can develop their own app using React/Angular and use Sitecore's Items. Later on Sitecore also introduces JSS (Sitecore Java Script Service) which allows developer to develop angular/react app with Sitecore (connected or disconnected mode). Again, details can be found &lt;a href="https://jss.sitecore.com/docs/getting-started/quick-start"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I have couple of articles already written to cover JSS in my LinkedIn, but i am planning to re-write here in my later articles.&lt;/p&gt;

&lt;p&gt;Now the question is, why did Sitecore introduce Identity Server? Well, The answer is, Sitecore introduces a heap of other applications which might not ties with Sitecore-platform and ships as a separate bundle and those applications require to authorize from Sitecore which is only possible if there is a SSO in place. To support that, Sitecore introduces Identity Server.&lt;/p&gt;


&lt;h4&gt;Example&lt;/h4&gt;: An example would be Sitecore Business Apps. It has a set of functionalities which are part of completely a new angular based application and uses Sitecore Identity Server to authorize it.

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9xUFTnyA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tlkkeua1vv1q5l40vys7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9xUFTnyA--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/tlkkeua1vv1q5l40vys7.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will notice it redirects to a new URL but before, it gets authorization from Sitecore. It basically collects the token from the Sitecore Identity Server and pass it to that app. Until Sitecore 8, it was using Form based authentication but from 9 onward, it's using that.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NbhJ-f6O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hbx23c85tke1pjjd5xg3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NbhJ-f6O--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/hbx23c85tke1pjjd5xg3.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;


&lt;h4&gt;How to register your app in Sitecore Identity Server &lt;/h4&gt;: Registering a new app in Sitecore Identity Server is quite easy. You need to go to identity server physical path and modify &lt;b&gt;"Config/production/Sitecore.IdentityServer.Host.xml" &lt;/b&gt; file.

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oE7XKNZL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/k5zyk87pjj3hifd2girc.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oE7XKNZL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/k5zyk87pjj3hifd2girc.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will notice, Clients node has CommerceClient and PostmanClient. The same way, we can create your own client. Just copy/paste the existing client section and name it according to your app.&lt;/p&gt;


&lt;h4&gt;Collect Token &lt;/h4&gt;: Now i will show, how token endpoint works in Sitecore Identity Server. Since postmanclient is already registered in Identity Server, we can use postman to collect a token as below:

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T0UfIuhk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/sdsz8ps3fzr99fztyzf8.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T0UfIuhk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/sdsz8ps3fzr99fztyzf8.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You will see different headers are provided with the token endpoint. Those are really important. Question would be, where did we define those? Well, inside the configuration obviously. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--uWkIv3J6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/yhkqjcwbh0yl6c638wwu.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uWkIv3J6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/yhkqjcwbh0yl6c638wwu.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can use that token to execute any Sitecore endpoints (Which is under Authorization). Let's test that. We have a endpoint that returns a list of environments. Lets testify that through that token:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nCmOiovh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0riq7o35crfcnmums48p.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nCmOiovh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/0riq7o35crfcnmums48p.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The same way, we can create our own Application and use token to authorize with the help of Sitecore Identity Server.&lt;/p&gt;


&lt;h4&gt;Next Article: &lt;/h4&gt;I tried to give an idea about Sitecore Identity Server and how to use it. Next article, i will try to explain how to create a small react application and use Sitecore Identity Server to authorize that.

&lt;p&gt;Cheers&lt;/p&gt;

&lt;p&gt;Arif&lt;br&gt;
&lt;a href="https://www.linkedin.com/in/mdarifuzzaman/"&gt;https://www.linkedin.com/in/mdarifuzzaman/&lt;/a&gt;&lt;br&gt;
My Channel: &lt;a href="https://www.youtube.com/channel/UCNV_WMRXkq6E4EojTX8XJPw"&gt;https://www.youtube.com/channel/UCNV_WMRXkq6E4EojTX8XJPw&lt;/a&gt;&lt;/p&gt;

</description>
      <category>sitecore92</category>
      <category>sitecore</category>
      <category>sitecoreidentity</category>
      <category>authentication</category>
    </item>
    <item>
      <title>Sitecore Commerce - Introduction</title>
      <dc:creator>Arif</dc:creator>
      <pubDate>Tue, 21 Jan 2020 01:27:35 +0000</pubDate>
      <link>https://dev.to/mdarifuzzaman/sitecore-commerce-introduction-59k5</link>
      <guid>https://dev.to/mdarifuzzaman/sitecore-commerce-introduction-59k5</guid>
      <description>&lt;p&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;br&gt;
Hi Guys,&lt;br&gt;
This is my first article on DEV. I have planned to write a series of articles with Sitecore Commerce. The idea is to cover from the beginning to reach a point where everyone can understand it and extend the commerce functionalities as required. You do not need to be a Sitecore certified to understand this. What you need is basic understanding of dotnet (C#) knowledge&lt;/p&gt;

&lt;p&gt;&lt;b&gt;What is Commerce&lt;/b&gt;: Commerce is a very generic term. But the main idea is to allow users to fulfill his journey towards a product purchase. It includes a array of products to be stored somewhere as a part of inventory to shipment. Fulfilling is really important, mainly people are being fulfilled via "delivery" or "pickup". &lt;/p&gt;

&lt;p&gt;A typical fulfillment process is as follows:&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--nEt0NHRg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2fp9oilfjak14q81ib6j.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nEt0NHRg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2fp9oilfjak14q81ib6j.JPG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Problem of commerce domain&lt;/b&gt;: Well, why we need commerce solution? The answer can be found from the below challenges:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Managing inventory&lt;br&gt;
Managing Cart &lt;br&gt;
Managing User&lt;br&gt;
Managing Cart state (Every state of your current cart)&lt;br&gt;
Managing fulfillment&lt;br&gt;
Integrating with existing system to update product status/state and fulfill&lt;br&gt;
Continuously running job to manage products' stock&lt;br&gt;
Extend the commerce functionalities for any new features&lt;br&gt;
Handling pricing and prepare for any sudden discount/pricing etc&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Those are couple of challenges lies on commerce domain. But if we start implementing/solving that, a lot more to come. Sitecore brings all of those problems into a solution and named as "Sitecore Commerce". &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Sitecore Commerce&lt;/b&gt;: Sitecore commerce is a dotnetcore based solution which provides solution of those mentioned problem and has a lot of extension points. Sitecore commerce follows odata to provide APIs so that we can integrate it with any platform. Note, You really do not need Sitecore platform to work with Sitecore Commerce. But Sitecore provides a lot of very useful business applications (Written in JSS in 9 onward but in Speak for previous version i.e 8) which you can not use if you do not use Sitecore as a platform. &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Commerce Business Tools (Commerce 8.*)&lt;/b&gt;: There are couple of business tools provided by Sitecore out of the box&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Merchandise manager: To manage products catalog&lt;br&gt;
Customer and Order Manager: Manage the orders&lt;br&gt;
Pricing and Promotions: Manage pricing and promotion&lt;br&gt;
etc&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;b&gt;Sitecore Commerce Architecture&lt;/b&gt;: Sitecore commerce uses couple of patterns together to implement the solution and follows very easy and organize approach.  I will brief some of the Sitecore Commerce's terms first before elaborating this.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Pipeline&lt;/b&gt;: Pipeline is a thing which can hold a collection of individual process/block and can pass the result to next subsequent processes/blocks. Those who are familiar with Sitecore, might relate this pipeline with Sitecore pipeline but it's slightly different. The ways commerce pipeline works are as follows:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;There is no config files to create/patch pipelines. We need to use code to create or patch a pipeline. I will show an example soon&lt;/p&gt;

&lt;p&gt;Pipelines can hold blocks. A single pipeline might have 10 blocks. When we trigger a pipeline, it basically triggers all the blocks one by one and pass the result as an argument to next block and so on.&lt;/p&gt;

&lt;p&gt;Pipelines and Blocks are the extension point. All the foundation pipelines are already written by Sitecore. We sometimes need to add our own pipelines/blocks or replace the existing ones. &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Example of creating a new pipeline with a single block&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;  &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sitecore&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Pipelines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
             &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AddPipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ISamplePipeline&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SampleDiscountPipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;configure&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;{&lt;/span&gt;
                            &lt;span class="n"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;MemberDiscountBlock&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;
                        &lt;span class="p"&gt;})&lt;/span&gt;
      &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Another example when a pipeline is already exists, we will add a new block in it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;    &lt;span class="n"&gt;services&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Sitecore&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;Pipelines&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;config&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;config&lt;/span&gt;
             &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ConfigurePipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;IAddCartLinePipeline&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;configure&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt;
                        &lt;span class="p"&gt;{&lt;/span&gt;
                            &lt;span class="n"&gt;configure&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Add&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;SpecialDiscountBlock&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; 
                            &lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="n"&gt;Before&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;ICalculateCartPipelineBlock&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;

                        &lt;span class="p"&gt;})&lt;/span&gt;

                        &lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Same way, we can use configure.Replace&amp;lt;&amp;gt;() to replace a existing block.&lt;/p&gt;


&lt;h2&gt;Pipelines and blocks are the building blocks of Sitecore commerce &lt;h2&gt;

&lt;/h2&gt;
&lt;/h2&gt;
&lt;p&gt;&lt;b&gt;Command &lt;/b&gt;: Sitecore commerce uses command pattern to trigger any command. An example would be:&lt;/p&gt;

&lt;p&gt;You have to execute a product to be added in the cart. For that, there would be some sort of IAddProductToCart command, once that fires up, command executes necessary pipelines and collect the result and return to caller.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Entity &lt;/b&gt; The heart of commerce: Entity is nothing but a object represents in JSON. Any changes in the cart or anything like add a product or remove a product, add fulfillment address, method etc will update the entity. In short, by examining an entity, we will know the state of the cart of a user.&lt;/p&gt;

&lt;p&gt;&lt;b&gt;Component &lt;/b&gt;: Contains the unit piece of business of a certain feature &lt;/p&gt;

&lt;p&gt;&lt;b&gt;Policy&lt;/b&gt; : Component can hold policy which will control how a certain component will work.&lt;/p&gt;

&lt;p&gt;In my next article, i will briefly explain about Entity, policy and component how all works together to solve a commerce problem. I will try to explain a real world scenario using those. As a intro, i believe it's already enough. Hold tight, will see you soon&lt;/p&gt;

&lt;p&gt;Arif&lt;/p&gt;

</description>
      <category>sitecore</category>
      <category>sitecorecommerce</category>
      <category>dotnet</category>
      <category>csharp</category>
    </item>
  </channel>
</rss>
