Try our conversational search powered by Generative AI!

K Khan
May 2, 2013
  4713
(0 votes)

Programing changes required while Upgrading Episerver Commerce R2 to R2SP1 and R2SP2 - Part 1

Below is summary of issue that we have faced in upgrading different sites from R2 to R2SP1 and R2SP2.

Basic steps

http://world.episerver.com/Documentation/Items/Installation-Instructions/EPiServer-Commerce/Upgrading-EPiServer-Commerce-from-version-1-R2-to-1-R2-SP1-/
And
http://world.episerver.com/Documentation/Items/Installation-Instructions/EPiServer-Commerce/Upgrading-EPiServer-Commerce-from-version-1-R2-SP1-to-1-R2-SP2-/

 

 

 

Breaking changes:

1 - Issue:
If you try to import the business foundation object / meta-class but you get Access Denied exception. Please check the access to the path
%CommerceManager%\\app_data\\ImportExport\\Commerce Manager\\metadata'.

Fix:
If this folder doesn’t exist, please create it.

2 - IShippingGateway:

Issue:
Backward compatability Issue. In Commerce R2SP1, IShippingGateway required implement ShippingRate GetRate(Guid methodId, Shipment shipment, ref string message), not ShippingRate GetRate(Guid methodId, LineItem[] items, ref string message).

Fix:
Therefore you need to add the new implementation for GetRate in your custom ShippingGateway and change all the call to GetRate function. Then rebuild the solution.

3 - Browsing the site and see the error:
Issue:
The Type 'EPiServer.Business.Commerce.CommerceSettings' needs to be remapped in the Dynamic Data Store, see the Errors collection for more information.

Fix:
Remapping can be done by applying the EPiServer.Data.Dynamic.EPiServerDataStoreAttribute attribute to the type,
setting its AutomaticallyRemapStore property to true and ensuring the <episerver.dataStore><dataStore> autoRemapStores attribute in web.config is set to true (or is not defined).
Alternatively call the Upgrade-EPiRemapDDSTypes cmdlet from Powershell.

Please run these commands in PowerShell:
Add-PSSnapin EPiServer.Framework.Install.6.2.267.1
Upgrade-EPiRemapDDSTypes -ApplicationPath $applicationPath -Type "EPiServer.Business.Commerce.CommerceSettings"
$appllicationPath is the path to root folder of cms site.


4 - Changes in index data and searching for catalognode:

If we want to search for the entries/products in a catalognode, we need to use the _outline field. The code should look like this:
    if (String.IsNullOrEmpty(categoryCode))
            {
                var productRootNode = CatalogContext.Current.GetCatalogNodes(CommerceSettings.Default.MainCatalogName, CommerceSettings.Default.ProductNodeCode);
                if (productRootNode.CatalogNode.Count() <= 0)
                {
                    return new List<Entry>();
                }
                foreach (var node in productRootNode.CatalogNode)
                {
                    //criteria.CatalogNodes.Add(node.ID);
                  
                }               
            }
            else
            {
                //criteria.CatalogNodes.Add(categoryCode);
                criteria.Outlines = SearchFilterHelper.GetOutlinesForNode(categoryCode);
            }
        
            criteria.CatalogNames.Add(CommerceSettings.Default.MainCatalogName);
            criteria.StartingRecord = 0;
            criteria.RecordsToRetrieve = 1000;

            var entries = SearchFilterHelper.Current.SearchEntries(criteria, out count,
                                                                   entryResponseGroup, false,
                                                                   new TimeSpan(0, 0, 0));
         
            if (entries.TotalResults == 0)

5 - After rebuilding and building the index, you can get the exception when searching on the site, you can get exception:

Issue:
System.IndexOutOfRangeException was unhandled by user code
  Message=Index was outside the bounds of the array.
  Source=Lucene.Net
  StackTrace:
       at Lucene.Net.Index.DocumentsWriter.Abort(AbortException ae)
       at Lucene.Net.Index.DocumentsWriter.UpdateDocument(Document doc, Analyzer analyzer, Term delTerm)

Fix:
The can be fixed by applying the CustomSearchProvider.


6 - Add the AuthorizedPaymentTotal by code when you see the error below:

Issue:
Cannot insert the value NULL into column 'AuthorizedPaymentTotal', table 'dbEPiServerCommerce.dbo.OrderForm'; column does not allow nulls. UPDATE fails.
The statement has been terminated.
Exception Details: System.Data.SqlClient.SqlException: Cannot insert the value NULL into column 'AuthorizedPaymentTotal', table ‘dbEPiServerCommerce.dbo.OrderForm'; column does not allow nulls. UPDATE fails.
The statement has been terminated.

Fix:
//workaround for these fields not accepting nulls
cart.Cart.OrderForms[0].AuthorizedPaymentTotal = 0;
cart.Cart.OrderForms[0].CapturedPaymentTotal = 0;

May 02, 2013

Comments

K Khan
K Khan May 3, 2013 10:21 AM

Part 2:
http://world.episerver.com/en/Blogs/K-Khan-/Dates/2013/5/Programing-changes-required-while-Upgrading-Episerver-Commerce-R2-to-R2-SP1-and-R2SP2---Part-2/

Please login to comment.
Latest blogs
Fix your Search & Navigation (Find) indexing job, please

Once upon a time, a colleague asked me to look into a customer database with weird spikes in database log usage. (You might start to wonder why I a...

Quan Mai | Apr 17, 2024 | Syndicated blog

The A/A Test: What You Need to Know

Sure, we all know what an A/B test can do. But what is an A/A test? How is it different? With an A/B test, we know that we can take a webpage (our...

Lindsey Rogers | Apr 15, 2024

.Net Core Timezone ID's Windows vs Linux

Hey all, First post here and I would like to talk about Timezone ID's and How Windows and Linux systems use different IDs. We currently run a .NET...

sheider | Apr 15, 2024

What's new in Language Manager 5.3.0

In Language Manager (LM) version 5.2.0, we added an option in appsettings.json called TranslateOrCopyContentAreaChildrenBlockForTypes . It does...

Quoc Anh Nguyen | Apr 15, 2024

Optimizely Search & Navigation: Boosting in Unified Search

In the Optimizely Search & Navigation admin view, administrators can set a certain weight of different properties (title, content, summary, or...

Tung Tran | Apr 15, 2024

Optimizely CMS – Getting all content of a specific property with a simple SQL script

When you need to retrieve all content of a specific property from a Page/Block type, normally you will use the IContentLoader or IContentRepository...

Tung Tran | Apr 15, 2024