+1-888-365-2779
Try Now
More in this section

Forums / General Discussions / Ecommerce Products Not Showing After Upgrade to 6.1

Ecommerce Products Not Showing After Upgrade to 6.1

6 posts, 0 answered
  1. Jim
    Jim avatar
    22 posts
    Registered:
    09 Sep 2010
    12 Aug 2013
    Link to this post
    Hello,

    I recently upgraded from SF 5.4.xxxx to 6.1.4300 and am
    experiencing the issue noted in this breaking changes document.  Can you
    please provide me with more detail (step-by-step) on how I run this
    script?

    http://www.sitefinity.com/documentation/documentationarticles/developers-guide/changes-and-backward-compatibility/breaking-changes-in-sitefinity-6-0/sitefinity-6-0-ecommerce-breaking-changes/troubleshooting/products-do-not-show-in-both-the-frontend-and-backend

    Thank you,
    Jim
  2. Jim
    Jim avatar
    22 posts
    Registered:
    09 Sep 2010
    12 Aug 2013
    Link to this post
    UPDATE:

    After posting, I found this in the forums --> http://www.sitefinity.com/developer-network/forums/bugs-issues-/sitefinity-6-1-upgrade---ecommerce-products-gives-error

    I am developing in VB, so I had to convert the code to this -->
    Imports System.Collections.Generic
    Imports System.Globalization
    Imports System.Linq
    Imports Telerik.OpenAccess
    Imports Telerik.Sitefinity.Ecommerce.Catalog.Model
    Imports Telerik.Sitefinity.Modules.Ecommerce.Catalog
    Imports Telerik.Sitefinity.Services
     
    Public Class EcomUpgradeFix
        Inherits System.Web.UI.Page
     
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            UpdateExistingProductsWithoutLifecycleSupport()
            Response.Write("All done!")
        End Sub
     
        Private Sub UpdateExistingProductsWithoutLifecycleSupport()
            Dim inactiveProducts As List(Of Guid) = CreateMasterProductsFromLiveOnes()
            PublishAllMasterProducts()
            UnpublishTheNotActiveProducts(inactiveProducts)
        End Sub
     
        Private Sub UnpublishTheNotActiveProducts(inactiveProducts As List(Of Guid))
            Using catalogManager__1 = CatalogManager.GetManager()
                Dim products = catalogManager__1.GetProducts().Where(Function(p) p.Status = Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live)
                Dim skip As Integer = 0
                Dim take As Integer = 100
                Dim currentCount As Integer = 0
                Dim totalCount As Integer = products.Count()
     
                While currentCount < totalCount
                    Dim chunkedProducts = products.Skip(skip).Take(take)
                    skip = skip + take
                    currentCount = skip
     
                    For Each productLive In chunkedProducts
                        Try
                            'all inactive old versions should be made invisible.
     
                            If inactiveProducts.Contains(productLive.OriginalContentId) Then
                                Dim publishedTranslations = New List(Of String)(productLive.PublishedTranslations.ToList())
                                'copy since the collection will be modified by the unpublish durring the loop
                                If publishedTranslations.Count() > 0 Then
                                    'unpublish for each translation
     
                                    For Each publishedTranslation In publishedTranslations
     
     
                                        catalogManager__1.Lifecycle.Unpublish(productLive, New CultureInfo(publishedTranslation))
     
     
                                        catalogManager__1.Provider.FlushTransaction()
     
                                    Next
                                Else
     
                                    'unpublish invariant only
     
                                    catalogManager__1.Lifecycle.Unpublish(productLive, SystemManager.CurrentContext.AppSettings.DefaultFrontendLanguage)
     
     
                                    catalogManager__1.Provider.FlushTransaction()
                                End If
     
     
                                catalogManager__1.SaveChanges()
     
                            End If
     
                        Catch innerEx As Exception
     
     
     
     
     
                        End Try
     
                    Next
     
                End While
            End Using
     
        End Sub
     
        Private Sub PublishAllMasterProducts()
     
     
            Using catalogManager__1 = CatalogManager.GetManager()
     
                Dim products = catalogManager__1.GetProducts().Where(Function(p) p.Status = Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master)
                Dim skip As Integer = 0
                Dim take As Integer = 100
                Dim currentCount As Integer = 0
                Dim totalCount As Integer = products.Count()
     
                While currentCount < totalCount
     
                    Dim chunkedProducts = products.Skip(skip).Take(take)
     
                    skip = skip + take
     
                    currentCount = skip
     
     
     
                    For Each productMaster In chunkedProducts
     
     
                        Try
     
     
                            Dim publishedTranslations = productMaster.PublishedTranslations
     
                            If publishedTranslations.Count() > 0 Then
                                'publish for each translation
     
                                For Each publishedTranslation In publishedTranslations
                                    catalogManager__1.Lifecycle.Publish(productMaster, New CultureInfo(publishedTranslation))
                                    catalogManager__1.Provider.FlushTransaction()
     
                                Next
                            Else
     
                                'publish for default
     
                                catalogManager__1.Lifecycle.Publish(productMaster, SystemManager.CurrentContext.AppSettings.DefaultFrontendLanguage)
     
     
                                catalogManager__1.Provider.FlushTransaction()
                            End If
     
     
                            catalogManager__1.SaveChanges()
     
                        Catch innerEx As Exception
     
                        End Try
     
                    Next
     
                End While
            End Using
     
        End Sub
     
        Private Function CreateMasterProductsFromLiveOnes() As List(Of Guid)
            Dim notActiveProducts As New List(Of Guid)()
            Dim currentUserId As Guid = Telerik.Sitefinity.Security.SecurityManager.GetCurrentUserId()
     
            Using catalogManager__1 = CatalogManager.GetManager()
                Dim products = catalogManager__1.GetProducts().Where(Function(p) p.Status = Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Live AndAlso IsNothing(p.OriginalContentId))
                ' yes it should be null not Guild.Empty
     
     
                For Each productLive As Product In products
                    productLive.Status = Telerik.Sitefinity.GenericContent.Model.ContentLifecycleStatus.Master
     
                    Dim isActiveLegacy = productLive.FieldValue(Of Boolean)("isActive")
     
                    'we cannot use reflection because open access has not populated the field yet so (bool)typeof(Product).GetField("isActive", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(productLive) will always return false
                    If Not isActiveLegacy Then
                        'TODO use the internal method because the property IsActive now uses lifecycle
                        notActiveProducts.Add(productLive.Id)
                        productLive.ApprovalWorkflowState = "Unpublished"
                    Else
                        productLive.ApprovalWorkflowState = "Published"
                    End If
     
                    If currentUserId <> Guid.Empty Then
                        productLive.Owner = currentUserId
                        productLive.OriginalOwner = currentUserId
                    End If
                Next
     
                catalogManager__1.SaveChanges()
            End Using
     
            Return notActiveProducts
     
        End Function
     
    End Class

    When I run the script from the page that I created, I get the following error:

    Execution of 'Microsoft.VisualBasic.Information:IsNothing(Object)' on the database server side currently not implemented.

    Can you please help me with this?  Please remember that I am developing in VB if you provide script examples or fixes.

    Thank you,
    Jim
  3. Jim
    Jim avatar
    22 posts
    Registered:
    09 Sep 2010
    12 Aug 2013
    Link to this post
    UPDATE:
    I got the script to run successfully, but the problem still exists.  When I try to access the Products in the backend, I get the following error message:  "Sequence contains no elements"

    Thanks,
    Jim
  4. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    15 Aug 2013
    Link to this post
    Hello Jim,

    For projects using the Ecommerce it is required that the upgrade path is 5.4 - 6.0-6.1. This is due to the major changes to the Ecommerce module and products. Please, try upgrading again and if the issue persists, get back to us in a support ticket so we can investigate further and then we will share the solution with the community.

    Regards,
    Atanas Valchev
    Telerik
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    15 Aug 2013
    Link to this post
    I'm still (a month after release) going back and forth with support...but tyr this..

    Edit your product types table and...

    The "ApplicationName" of your product type in DB is "/Catalog", but the system is looking for "/EcommerceCommon". Change this and you will see the products listed.
  6. Steve
    Steve avatar
    3037 posts
    Registered:
    03 Dec 2008
    16 Aug 2013 in reply to Steve
    Link to this post
    Sorry, nevermind...while it appears to work, the product.svc just outright crashed

    ...who cares though eh, customers don't need working (or supported) modules.
6 posts, 0 answered