Saturday, January 12, 2019

Sitecore commerce - Fix for Catalog Item of the Storefront catalog Configuration cannot be found

I got below error after Sitecore re-installation -

Catalog Item of the Storefront catalog Configuration cannot be found.

Fix - to resolve that issue I opened the Sitecore catalogs item, selected the Habitat_Master and published the item, It resolved the issue for me.

Friday, January 4, 2019

Sitecore Commerce 8.2.1 - Create a custom order number and few tips.


We got a requirement to generate a custom order number, Here are a few simple steps for that.

Steps 1  - Define a new environment variable in

\Environments\Shops-1.0.0.json


       

      {
        "$type": "Foundation.Commerce.PaymentsDataTest.Engine.Policies.OrderNumberPolicy, Foundation.Commerce.PaymentsData.Engine",
        "TestStoredProcedureName": "[dbo].[Test_GetNextOrderNumber]",
        "TestOrderNumberPrefix": "W",
        "TestDisableReGenerateOrderNumber": true
      },
       
 



Steps 2  - Define a new policy in the Commerce plugin -

Foundation.Commerce.PaymentsData\Engine\Foundation.Commerce.PaymentsData.Engine\Policies\OrderNumberPolicy.cs


       

    public class OrderNumberPolicy : Policy
    {
        /// 
        /// Stored procedure Inserting OrderNumber
        /// 
        public string TestStoredProcedureName { get; set; }

        /// 
        /// Prefix for Order Number
        /// 
        public string TestOrderNumberPrefix { get; set; }
        /// 
        /// Gets or sets a value indicating whether [disable re generate order number].
        /// 
        /// 
        ///   true if [disable re generate order number]; otherwise, false.
        /// 
        public bool TestDisableReGenerateOrderNumber { get; set; }
    }
       
 

Steps 3 - Extend the feature project - here

Feature.Commerce.Payments\Engine\Feature.Commerce.Payments.Engine\Pipelines\Blocks\GenerateOrderNumberBlock.cs



     

  public override async Task Run(Cart cart, CommercePipelineExecutionContext context)
        {
            

            try
            {
                TestOrderNumberPolicy ObjorderNumberPolicy = context.GetPolicy();

                TestorderNumberComponent.OrderNumber = _customComponent.GetNextOrderNumber(context.CommerceContext, orderNumberPolicy.TestStoredProcedureName, orderNumberPolicy.TestOrderNumberPrefix);
            }
            catch (Exception e)
            {
            }
            return cart;
        }
 


Steps 3 -  Custom table for the order number



     

 USE [Test.Website.CustomDetails]
GO


SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Test.OrderNumberSequencer](
 [Id] [bigint] IDENTITY(10000000,1) NOT NULL,
 CONSTRAINT [PK_Test_Sequence_OrderNumber] PRIMARY KEY CLUSTERED 
(
 [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO


Steps 4 -  Sample store procedure to get the latest/incremental number -



     
USE [Test.Website.CustomDetails]
GO

SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

CREATE TABLE [dbo].[Test.OrderNumberSequencer](
 [Id] [bigint] IDENTITY(10000000,1) NOT NULL,
 CONSTRAINT [PK_Test_Sequence_OrderNumber] PRIMARY KEY CLUSTERED 
(
 [Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
G


Steps 5- In case if we want to update the sequence of order number -

     
Steps 1 –  exec [dbo].[Test.OrderNumberSequencer] to check the current number
Step 2 – Run this script to update the sequence 

SET IDENTITY_INSERT dbo.Test.OrderNumberSequencer  ON
GO
-- Insert the record which you want to update with new value in identity column
INSERT INTO Test.OrderNumberSequencerId (Id) VALUES(300000)
GO
--Now set the idenetity_insert OFF to back to prevoius track
SET IDENTITY_INSERT Test.OrderNumberSequencerId OFF

Steps 3 Run this sp to see the current number - exec [dbo].[Test.OrderNumberSequencer] - Please take a note of that number


These are a very simple steps if you want to add a custom order number or any values/reference field in the Sitecore commerce engine,

Happy coding :)

Tuesday, January 1, 2019

How to delete replica manually - Solr Cloud.

We have been working on Solr cloud and it's very common issue that on your local system replicate may goes down.

Ideally, Local system should have only 1 replication factory but in case if you have crated multiple replica and those are not responding, Here are a few simple steps to remove those replica manually.

Go to that collection and expend the shard


Here you will see an option to delete the replica.



Sunday, December 30, 2018

History of Sitecore Experience Commerce..

Here is the high-level architecture view -


Previously known as Microsoft Commerce Server, it is now developed, sold, and supported by Sitecore, Sitecore acquired commerceserver.net in late 2013 and released the product as Sitecore Commerce Server in 2014.

Sitecore Commerce Server has the following components:

Core Systems:
  1. Catalog
  2. Inventory
  3. Order Capture
  4. Discounts
  5. Profiles
Integration Points:
  1. Orders Web Service 
  2. Catalog and Inventory Web Service + BizTalk Adaptor
  3. Profiles Web Service 
  4. Marketing Web Service
Desktop Business Tools:
  1. Catalog Manager
  2. Marketing Manager
  3. Customer and Order Manager
Commerce Server
Merchandising Manager (replacement of Catalog Manager)
Sitecore Experience Platform Integration
Integration – Oracle E-Business Suite
Sitecore Experience Commerce - SAP Integration

With the latest release, Sitecore commerce has below core components -
  1. Shopping Cart The ability to add/remove/update products stored in the cart
  2. Inventory Edit and control each Products inventory
  3. Orders Manage an order through its full lifecycle.
  4. Checkout Capture all of the necessary information required to complete an Order
  5. Entitlements Entitlements track ownership and are used for things like Digital Downloads
  6. Pricing Powerful pricing functionality to enable flexible,dynamic pricing for your products 
  7. Shops Create multiple online shopping experiences, defining currency, language & payments for each.
  8. Fulfillment Complete fulfillment management, whether this is for digital or physical goods.
  9. Promotions Flexible & extendable promotions functionality.
  10. Catalog The ability to create and manage the catalog of items on sale in your shops.
  11. Payments Simple to integrate with 3rd party payment providers



Monday, November 12, 2018

Small issue and fix for at least one object must implement icomparable.

 Recently, I was adding a check for order by and found this issue.


It was because of I put the order by field as  Item["FieldName"] it should be on value like Item["FieldName"].value

Saturday, November 10, 2018

Sitecore® Experience Commerce™ 9 - Certification 100, 200 and 300




There are basically three main courses for the Sitecore commerce

Sitecore® Experience Commerce™ 9 100: Overview

Getting Familiar with Sitecore® Experience Commerce™
Managing the Catalog
Tracking Customers and Their Orders
Increasing Sales with Marketing




Sitecore® Experience Commerce™ 9 200: Essentials

Gaining an Insight into the Sitecore® Experience Commerce™ Architecture
Developing Storefronts Using Sitecore Commerce APIs
Developing Sitecore® Experience Commerce™ Storefront Pages Using SXA
Working with Sellable Items etc.



Sitecore® Experience Commerce™ 9 300: Developer

Create & configure a new Storefront Site
Creating a Site Page Framework – you go through how you create the header and footer components and assign those to a page layout for all the page.
Creating pages for the Storefront for displaying sellable items like category pages and product pages.
Creating account management pages for registration, login, my account page, addresses page, etc.
Creating the order flow pages for cart, billing, shipping, payment and confirmation.

I got a chance to get all understand of 9.0 300 certifications full training session, and received all required documentation, tutorials and sample projects.

Reference -




Sunday, November 4, 2018

Sitecore commerce- Steps to update the search bar text and Top Bar Links

Here is the simple step to update the SXC search bar text and top bar link -

Content path:- /sitecore/content/Sitecore/Storefront/Data/Commerce/Search Bar/Search Bar



and for top bar link - /sitecore/content/Sitecore/Storefront/Data/Commerce/Top Bar Links/Top Bar Links

We can customize here -


The Sitecore commerce contact structure is well defined and easy to navigate and update.