Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

EPiServer.Business.Commerce.Providers.StaticUrlProvider not finished for EPiServer 7.x?

Vote:
 
EPiServer.Business.Commerce.Providers.StaticUrlProvider class has private method GetLinkFromSettings that requires parameter commandName. It supports 14 or so commands. By looking at code  we can see that 12 of these methods are aware of EPiServer 7.x, but two still think its EPiserver 6.x, why is that so?

begining of GetLinkFromSettings method:
private string GetLinkFromSettings(string commandName)
        {
            if (this._urls == null)
            {
                this._urls = new StringDictionary();
            }
            if ((ContentReference.get_StartPage() == null) || PageReference.IsNullOrEmpty(ContentReference.get_StartPage()))
            {
                return string.Empty;
            }
            string entryViewPage = string.Empty;
            PageReference reference = null;
            PageData data = null;
            switch (commandName.ToUpperInvariant())
            {
                case "ENTRYVIEW":
                    entryViewPage = GetEntryViewPage();
                    break;
                
                case "NODEVIEW":
                    entryViewPage = GetNodeViewPage();
                    break;
                
                case "CHECKOUT":
                    reference = DataFactory.get_Instance().GetPage(ContentReference.get_StartPage()).get_Item("CheckOutPage") as PageReference;
                    break;
                
                case "SHOPPINGCART":
                    reference = DataFactory.get_Instance().GetPage(ContentReference.get_StartPage()).get_Item("ShoppingCartPage") as PageReference;
                    break;
                
                case "WISHLIST":
                    reference = DataFactory.get_Instance().GetPage(ContentReference.get_StartPage()).get_Item("WishListPage") as PageReference;
                    break;
                
                case "ACCOUNT":
                    reference = DataFactory.get_Instance().GetPage(ContentReference.get_StartPage()).get_Item("AccountPage") as PageReference;
                    break;
...........
.....
.

Stright away we can see, for example, CHECKOUT command tries to convert start page property to PageReference as it is don by almost all other commands, except ENTRYVIEW for example, to se it we need to dive into begging of GetEntryViewPage method:
private static string GetEntryViewPage()
        {
            _logger.Info("Getting entry view page from start page");
            string str = (string) (DataFactory.get_Instance().GetPage(ContentReference.get_StartPage()).get_Item("DefaultEntryViewPage") as string);
.......
....
It tries to convert property(that should point to page Reference) to string and even if that pageReference in start page is set - it will convert to null and therfor method does not work as it did in EPiServer 6.x


Is this intentional? Am i missing something? Maybe this class is not to be used, but then its not marked as obsolete? What have happened here?

At the moment I have fixed it by reflecting and modifying this class and making appropriate changes to urlService in web.config so result is as I expect it, but this should be fixed unless there is some really good reason not to, is there?

PS. This code is from package: EPiServer.Commerce.Core.7.10.3 Version:7.10.3.184

#90755
Sep 17, 2014 13:07
Vote:
 

Hi,

I think you're correct, this class should be obsoleted, especially the EntryView and NodeView are now totally obsolete - in 7.5 we switched to CMS-style page view and not recommend the old "DisplayTemplate" way anymore. I believe it was introduced to provide some "standardized way" to set some specific page settings for Commerce, but it provides very little value now. 

Thank you for bringing this to our attention. I'll file a bug for that.

Regards.

/Q

#90769
Sep 17, 2014 16:06
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.