More in this section
Forums / Ecommerce / Custom front end product sorting

Custom front end product sorting

The forums are in read-only mode. In case that you want to directly contact the Progress Sitefinity team use the support center. In our Google Plus group you can find more than one thousand Sitefinity developers discussing different topics. For the Stack Overflow threads don’t forget to use the “Sitefinity” tag.
1 posts, 0 answered
  1. Jeffrey Monroe
    Jeffrey Monroe avatar
    7 posts
    Registered:
    06 Feb 2005
    06 Oct 2012
    Link to this post
    I am working on a way to sort the list of products by inheriting from Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI.ProductsView

    Here is my codes so far:
    Public Class ProductList
        Inherits Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI.ProductsView
     
     
        Private m_sortOrderOverride As String = String.Empty
        Public Property SortOrderOverride() As String
            Get
                Return m_sortOrderOverride
            End Get
            Set(ByVal value As String)
                m_sortOrderOverride = value
            End Set
        End Property
     
     
        Protected Overrides Sub LoadView(viewName As String)
            MyBase.LoadView(viewName)
     
            If Not String.IsNullOrEmpty(m_sortOderOverride) Then
                Dim listView As Telerik.Sitefinity.Web.UI.ContentUI.ContentViewMasterDefinition = MyBase.ControlDefinition.Views.Item(0)
                listView.SortExpression = m_sortOrderOverride
            End If
     
        End Sub
     
     
    End Class

    The issues I am having is that setting the SortOrderOverride to any sort string utilizing custom fields defined in the product type causes the following exception.
    [NullReferenceException: Object reference not set to an instance of an object.]
       Telerik.Sitefinity.Data.Linq.Dynamic.ExpressionParser.ParseComparison() +64
       Telerik.Sitefinity.Data.Linq.Dynamic.ExpressionParser.ParseLogicalAnd() +54
       Telerik.Sitefinity.Data.Linq.Dynamic.ExpressionParser.ParseLogicalOr() +54
       Telerik.Sitefinity.Data.Linq.Dynamic.ExpressionParser.ParseExpression() +27
       Telerik.Sitefinity.Data.Linq.Dynamic.ExpressionParser.ParseOrdering() +43
       Telerik.Sitefinity.Data.Linq.Dynamic.DynamicQueryable.OrderBy(IQueryable source, String ordering, Object[] values) +203
       Telerik.Sitefinity.Data.Linq.Dynamic.DynamicQueryable.OrderBy(IQueryable`1 source, String ordering, Object[] values) +29
       Telerik.Sitefinity.Data.DataProviderBase.SetExpressions(IQueryable`1 query, String filterExpression, String orderExpression, Nullable`1 skip, Nullable`1 take, Nullable`1& totalCount) +304
       Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI.Views.ProductsMasterView.GetDataSource() +908
       Telerik.Sitefinity.Modules.Ecommerce.Catalog.Web.UI.Views.ProductsMasterView.ProductsListView_NeedDataSource(Object sender, RadListViewNeedDataSourceEventArgs e) +47
       Telerik.Web.UI.RadListView.OnNeedDataSource(RadListViewNeedDataSourceEventArgs e) +197
       Telerik.Web.UI.RadListView.AutoDataBind(RadListViewRebindReason rebindReason) +183
       Telerik.Web.UI.RadListView.OnPreRender(EventArgs e) +38
       System.Web.UI.Control.PreRenderRecursiveInternal() +112
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Control.PreRenderRecursiveInternal() +221
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4200


    I suspect that the base query does not contain the custom fields.

    Does anyone have a workaround?

    Thanks,
    -jm
1 posts, 0 answered