Upgrading EPiServer Commerce R3 to EPiServer 7.5 – upgrade script errors

Here is a little summary of problems and solutions with the Commerce upgrade script.

Run Deployment Center as administrator. The upgrade script upgrades both EPiServer 7.0 and EPiServer Commerce R3 to EPiServer CMS and Commerce 7.5. So the first step is to choose: “Upgrade EPiServer Commerce”

Next step choose the CMS 7 “Commerce enabled” www site to upgrade. (Not the Commerce manager site)

This is the running script:
“C:\Program Files (x86)\EPiServer\CMS\7.5.394.2\Install\Modules\EPiServer Commerce 7.5.394.2\Install\Upgrade EPiServer Commerce.ps1”

This is where you could inspect the log if it fails: (latest modified file)
C:\Program Files (x86)\EPiServer\Shared\Install\Logs

Errors

Could not find file ‘C:\sites\MySite.Web\b\web.config’1.

Solution: Set  <appSettings> key “CommerceManagerApplicationName” to the Commerce Managers current IIS ApplicationPool name.
E.g:

<add key="CommerceManagerApplicationName" value="MySiteCommerceManager_v4.0" />

 

Line 418 fails: Could not find file ‘C:\commerce\MySite.CommerceManager.Web\b\web.config’.

Solution: this line:  $commerceManagerPath = $commerceManagerBinPath.trimEnd(“Bin”)
Is hardcoded in the ps1 script. Replace the appsetting “CommerceManagerBinPath” in wwwroot web.config file “bin” in the path to “Bin”. E.g:

<add key="CommerceManagerBinPath"         value="C:\Commerce\MySite.CommerceManager.Web\Bin"

 

“Could not find Tools.zip”

Copy Tools.zip from wwwroot\MediachaseECF\* (from a functioning, or demo, epi7 commerce r3 site) to upgradeprojects\wwwroot\MediachaseECF\*.

This file also seems to be deleted after every upgrade attempt.
Download here: Commerce_Tools.zip_for_r3_and_75

Cannot find package “EPiServer.Business.Commerce.AddOns.Manager” in local repository.

–  In your wwwroot\modulesbin folder there should be a EPiServer.Commerce.AddOns.Manager.dll file, the EPiServer.Business.Commerce.AddOns.Manager.dll is EPiServer Commerce R3 specific and should be deleted.

Remove-Item : Cannot find path ‘C:\commerce\MySite.CommerceManager.Web\bin\Mediachase.Cms.Website.dll’ because it does not exist.

At C:\Program Files (x86)\EPiServer\CMS\7.5.394.2\Install\Modules\EPiServer Commerce 7.5.394.2\Install\Upgrade EPiServer Commerce.ps1:378 char:3

Solution: copy the Mediachase.Cms.Website.dll from C:\Program Files (x86)\EPiServer\CMS\7.0.586.1\Install\Modules\EPiServer Commerce 7.0.243.0\ECF\Data\ConsoleSite\bin to manager bin folder.

A note on EPiServer Commerce entry data and serialization

To improve performance, catalog entry meta data is serialized and stored in a field for each catalog entry. This allows all meta data information to be fetched from a single field and de-serialized, which reduces the number of database calls and greatly increases performance compared to non-serialized data fields.

The SerializedData field should be updated after updating any catalog data through 3rd party sources. The SerializedData field is part of the CatalogEntryDTO (data transfer object), and will be cached based on catalog cache settings. Storing images and files in meta fields will increase the size of the serialized data, and increase catalog cache size.

From the Commerce 7.5 documentation:
http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Commerce/75/Catalogs/Guidelines-for-working-with-catalogs/

Simple SQL script to show all Associations in EPiServer Commerce 1

There seem to be no good way to show all Entry Assocations (e.g. entries that have listings for accesories or related products set),  in Commerce, so I just created some simple SQL scripts

Show all

SELECT CatalogAssociation.CatalogEntryId, CatalogEntry.Code, CatalogEntry.Name, CatalogAssociation.AssociationName
FROM    CatalogAssociation INNER JOIN
                 CatalogEntry ON CatalogAssociation.CatalogEntryId = CatalogEntry.CatalogEntryId

If you need the associated entries as well, dig into this table:
[dbo].[CatalogEntryAssociation]

Where association contains ‘Expired’

SELECT CatalogAssociation.CatalogEntryId, CatalogEntry.Code, CatalogEntry.Name, CatalogAssociation.AssociationName
FROM    CatalogAssociation INNER JOIN
                 CatalogEntry ON CatalogAssociation.CatalogEntryId = CatalogEntry.CatalogEntryId
				 where CatalogAssociation.AssociationName like '%Expired%'

Most common associations counted
A variant for showing the most common associations (counted) are:

SELECT distinct CatalogAssociation.AssociationName, Count(*) as Count 
FROM    CatalogAssociation INNER JOIN
                 CatalogEntry ON CatalogAssociation.CatalogEntryId = CatalogEntry.CatalogEntryId
				 GROUP BY AssociationName
				 order by Count Desc

EPiServer Commerce Cache handling

Just a snippet from my Certification studies:

//Commerce Cache handling
//cache invalidation time is configured in ecf.[objecttype].config
//e.g. ecf.catalog.config element
CatalogCache.Clear(); //clears the entire catalog cache
CatalogCache.Remove(“entrykey”); //invalidate a specific entry
CustomersCache.Clear(); //clear all customers cache
MarketingCache.Clear();
OrderCache.Clear();
SecurityCache.Clear();

More info:
http://world.episerver.com/Documentation/Items/Developers-Guide/EPiServer-Commerce1/75/Caching/Caching/

EPiServer Commerce R1 – Trigger Lucene Searching and Indexing

If you want to use certain parts of the Commerce Manager (e.g. Marketing -> Promotion -> “Order: Buy X, get N quantity of Y at a discount”. -> Catalog entries picker, the Commerce default Lucene search indexer must be active.

Else you get this error inside the picker window:

System.IO.FileNotFoundException: no segments* file found in Lucene.Net.Store.FSDirectory

The searchindex creation can be triggered manually through Manager -> Administration -> System settings -> Search Index.

Scheduled jobs should be available in CMS but here is how to trigger the indexing through code:

via Searching and Indexing.

Build index command

SearchManager searchManager = new SearchManager(applicationName);

searchManager.BuildIndex(false);

Set EPiServer Commerce 1 caching on nodes/entries

<?xml version="1.0"?>
<Catalog autoConfigure="true">
  <Connection connectionStringName="EcfSqlConnection" />
  <Cache enabled="true" collectionTimeout="0:1:0" entryTimeout="0:1:0" nodeTimeout="0:1:0" schemaTimeout="0:2:0" />

entries and nodes cache timeout is set to 1 minute.

Changes in Commerce should affect the “productpage” in the website immediately but  sometimes the cache invalidation dont work. The above setting is ultimately the cache timeout then.

 

EPiServer Commerce R2 SP1 available metatypes and their UI representations

List of Commerce meta properties types and their Commerce manager representation UI:ScreenShot671 The meta type is the same as the field-“name” but remove “test” E.g. “datetime”, “integer” type and so on.

All seem to validate in a predictable way, e.g. the email type must be a valid email in the textbox, except the “Url” meta type which doesn’t seem to validate at all(?).

The “file”-type is multi file upload initially.

“imagefile” type has a preview of the image.

“dictionary” doesnt seem to have any remove value function(?).

If invalid data is entered, a red * will appear next to the field and in the top of the page upon save.

A little warning though, this is tested in Chrome web browser which isn’t the best browser when using the Commerce Manager (IE 7 is recommended). Some types might behave behave in a better way in Internet Explorer.

Extra warning: when I added all the different meta fields the “Catalog Node Edit” function stopped working in Commerce Manager UI. Like this:

[FormatException: Input string was not in a correct format.]
   System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +10170355
   System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +207
   Mediachase.Commerce.Manager.Catalog.Tabs.NodeOverviewEditTab.BindMetaForm() +376

There is probably one of the properties that is not working correctly in the Commerce manager UI (buggy). And the function BindMetaForm() just fails.

Lesson learned: mess gently, very gently with commerce meta properties!

More on the subject – How to Create custom metafields controls in the UI: http://sdk.episerver.com/commerce/1.1.1/Content/Developers%20Guide/Architecture/ExtendCustomizeMetaFieldControls.htm