Author: Vikas chauhan

SITECORE UPGRADE FROM 8.2 V TO 10.2 V NUTS AND BOLTS

Recently I have started the Sitecore upgrade of 8.2 v to 10.2 one of our client which having the multisite solution. Sitecore has provided the very comprehensive guide and direct upgrade path of Sitecore 8.2 to Sitecore 10.2. Best part is we can directly upgrade Sitecore 8.2 instance to Sitecore 10.2 version.

Apart from following the Sitecore upgrade path we have to consider the following key area’s before the upgrade start.

  1. Pipeline Customization
  2. WFFM form
  3. xDb API
  4. Search
  5. Glass mapper
  6. Sitecore deprecated class post 8.2 version
  7. Sitecore modules customization.
  8. Sitecore Client customization

Following approach we have taken to upgrade the Sitecore 8.2 to 10.2 version:

  • Upgrade  .net framework to 4.8 for all projects in Solution.
  • Upgraded the DLL.s nugget package (Verify the Sitecore DLL’s version from Sitecore Assembly list provided on below link  under section  “Release informationhttps://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/102/Sitecore_Experience_Platform_102.aspx
  • Disable all the patch files.
  • Resolve the Compilation error
  • Install Sitecore 10.2 vanilla instance.
  • Upgrade the Master,Web and core databases ( If there on customization not done in Core DB then in this case use Core database installed at the time of step 4)
  • Connect upgraded database to Sitecore 10.2 Vanilla instance.
  • Deploy the upgraded code to new Sitecore 10.2 instance.
  • Test the application and resolve the run time error
  • Enable one by one patch files.

During upgrade we  have found some issues and below are the issues with the solution.

Depreciated Code in Sitecore 10.2:

Issue 1:  Sitecore.Eventing.EventManager.QueueEvent

Solution: We have to use instead of above code the following class:    Sitecore.Eventing.EventQueue.QueueEvent 

Issue 2: In Sitecore 8.2 to get the Device information we use below code but it is depreciated in Sitecore 10 version.

    Sitecore.CES.DeviceDetection. GetDeviceInformation(useragent);

Solution : In Sitecore 10.2 instead of above code use the below code

using Sitecore.CES.DeviceDetection;
using Sitecore.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;

DeviceDetectionManagerBase deviceDetectionManager = ServiceLocator.ServiceProvider.GetRequiredService<DeviceDetectionManagerBase>();
if (deviceDetectionManager.IsEnabled)
{

var deviceInfo = deviceDetectionManager.GetDeviceInformation(userAgent);
return deviceInfo;
}

Issue 3:  In Sitecore 10.2 save/update/adding facet to contact is having different code because some classes as example IContactEmailAddresses” is obsolete post Sitecore in 9.3.

Issue 4:  Needs to upgrade Glassmapper module to 5.8.18 version and post that we have refactor some code as given below. ISitecoreContext has been deprecated, now  we need to use IMVContext instead of this.

Solution: Sample code    IMvcContext gmContext = new MvcContext();

var footer = gmContext.SitecoreService.GetItem<footer >(id);

If you want to get the inherited template and item then in this case pass the InferType property true.

var option=new GetItemsByIDOptions(id){InferType=true;}

var footer = gmContext.SitecoreService.GetItem<footer >( option);

Issue 5: LinkManager changes – In Sitecore 8.2 to get the Item Url using custom options would be achieved by below URL

  • var options = LinkManager.GetDefaultUrlOptions();
  • var url = LinkManager.GetItemUrl(item, options);

Solution : In Sitecore 9.3, the class Sitecore.Links.UrlOptions becomes obsolete as well as all methods that use it. Below is the code sample code which needs to change in Sitecore 10 as well.

  • var options = LinkManager.GetDefaultUrlBuilderOptions();
  • var url = LinkManager.GetItemUrl(item, options);

Migration Of WFFM Form to Sitecore forms POV :

  1. We have used the “WFFM-Conversion-Tool” (https://github.com/afaniuolo/WFFM-Conversion-Tool) and successfully migrated the WFFM form data and Sitecore items to Sitecore 10.2 instance.
  2. All custom action or fields code needs to rewrite manually to work with Sitecore forms.
  3. CSS needs to be change as per Sitecore forms structure WFFM form CSS will not work as it is.

Thanks to Alessandro Faniuolo for creating such amazing tool which helps to all Sitecore community.

There are some more challenges we have faced I will cover all those in next part.

Configure Cover Image To Sitecore Contenthub Entity Detail Page

My requirement is to set the cover image on Custom Entity detail page and to configure the cover image as per Sitecore Content hub document following below steps 

  1. Add new field in Custom Entity (Book) named as “BookToMasterAsset” and Entity relation by configuring RenditionRelation = True in advanced Tab.
  2. Add Book entity search page based on “blank Page” and add Search control.
  3. Configure the Search control by adding Filter as “Book” entity and add entity operation “Set as Master” by assigning the “BookToMasterAsset”
  4. Create new Entity detail page and add Entity image control https://docs.stylelabs.com/contenthub/4.1.x/content/user-documentation/manage/portal/pages/page-components/entity-image.html?rp=true
  5. Set the “Rendition” field of Image control as Thumbnail.

The expected result should be that the cover picture appears on the entity detail page, but there is one caveat in version 4: the Asset Detail Page Cover Image throws an error ( Relation with name “BookToMasterAsset” does not exist). 

After consulting with Sitecore, I discovered that this is a known fault with Contenthub 4 that will be addressed in the future release.

Solution: We have to change the value of “Rendition” field of Image control to “Preview” or “Square”.

OrderCloud HeadStart Featured Products Configuration

We saw how to set up the OrderCloud Headstart buyer and seller websites in the previous article.
My buyer application’s main page is blank after I configured my Ordercloud Headstart application.


I examined the code and discovered that the feature products list must be presented on home page, and the logic is already there in the buyer application code. Here is where we may look at the code that has been implemented here.

In second screen shot you can check “xp.Featured” filter is responsible to get the featured products from Order cloud commerce. Featured is the extended property and it is not configured and found in Headstart Seller code. To enable this feature we have to configure or managed the Featured products in the seller application and this code is missing.

I have implemented the feature product configuration code in seller application. We have added the featured product checkbox field in Product creation section (please see below screen shot). Admin or seller can able to set the product as a featured product by selecting the Featured checkbox flag.

We have to update existing component code and please find the below detail below.

Component location path: src\UI\Seller\src\app\products\components\product-edit\product-edit.component.html.

Add below html block under “productInReviewNotifications” .

Code base location : src\UI\Seller\src\app\products\components\product-edit\product-edit.component.ts

Add Feature extended property to handleUpdateProduct method.See below screenshot.

Add below code line to createProductForm function.

Featured: new FormControl(_get(superHSProduct.Product, ‘xp.Featured’)

Add below code to existing code file :- src\UI\Seller\src\app\products\product.service.ts

Featured property to XP object.

By adding all the above code to Seller application code you are able to see the feature product listing on buyer application home page.

References

  • Find documents here
  • Headstart Repo here

How and Why Sitecore Upgrade

In this article we will try to cover the Sitecore upgrade checklist and process. Before I get into the details of the Sitecore upgrade, I’d like to go through the evolution of Sitecore and why we need Sitecore upgrade.

Sitecore Evolution post sitecore 5 version. Please find the sort description and features released in each versions

Why Upgrade?

As we know IT/Business team and end user are directly associated to your Sitecore solution. In organization’s IT and business users are asking themselves, “What are all the benefits we will get after the upgrade?” As a service/implementation provider, we sometimes have to persuade customers to upgrade for the right reasons.

In this section, I’ll try to discuss the various reasons for upgrading Sitecore, which can vary depending on the organization, but some are extremely common and apply to all organizations.

Reasons To Upgrade

Sitecore 10.1 new features list you will find from given below url’s.

https://dev.sitecore.net/Downloads/Sitecore%20Experience%20Platform/100/Sitecore%20Experience%20Platform%20100/Release%20Notes

https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/101/Sitecore_Experience_Platform_101_Update1.aspx

https://dev.sitecore.net/Downloads/Sitecore_Experience_Platform/101/Sitecore_Experience_Platform_101.aspx

Sitecore 10.1 features list

Sitecore Product Support Lifecycle:

The following table describes current phases of the Sitecore Product Support Lifecycle for various Sitecore products, as well as the expected dates for transitioning to the subsequent support phases.

Ref Url: https://support.sitecore.com/kb?id=kb_article_view&sysparm_article=KB0641167

Add alt text

We now have a better understanding of why we need to upgrade the Sitecore ,Let’s talk about how we’ll upgrade the Sitecore.

Before beginning any upgrade, we must first plan carefully and create a checklist. In the screenshot below, I’ve included a some high level of activities.

We’ve already completed the checklist and all of our preparations. Let’s have a look at the options presented by the Sitecore update. According to Sitecore, there are distinct approaches for versions less than 8 and versions larger than 8.Please fin the below diagram to understand both the options.

High level Steps involves in upgrading the Sitecore instance and code base.

Depreciated or removed functionalities in Sitecore 10.x .

References