Featured products not working?


https://forum.kartris.com/Topic1301.aspx
Print Topic | Close Window

By simonridley - Tue 6 Sep 2011
Hi

When I add a featured product, it does not appear on the front-end and when I return to the featured products admin page no products are listed

In the products table it is correctly updating with a number in the featured column.

I ran the stored procedure in the database and it returns a list of products OK

Hope you can help

Simon
By clifford-pabs - Tue 6 Sep 2011
Hi,
In the back end config settings, look for the following;

frontend.featuredproducts.display.max

by default, it is set to 0. you can change this to the number of featured products you wish to display on the site. You can have a maximum of 5.

Hope this helps
By clifford-pabs - Tue 6 Sep 2011
Actually 5max is not entirely true, you can change the value to -1 for unlimited featured products.
By simonridley - Tue 6 Sep 2011
Hi thanks but this was already set to 5 as per default install

Simply that neither the back end or front end recognises that any products have been added

So in the Admin/_FeaturedProducts.aspx page even though I have added some products none are listed

Thanks
By Paul - Wed 7 Sep 2011
Are you sure you saved the featured products you set? After you add items to the featured products list in the back end, you must hit the 'save' disk icon above to save any changes.
By simonridley - Wed 7 Sep 2011
Hi Paul

Yes it's definately saved, as when I refresh the database table I can see the updated row for Featured with the priority number

However, it still does not appear in the front end, and when I leave and visit the back-end page again it's empty

So am I to understand this is not a known issue?

Cheers
Simon
By Mohammad - Wed 7 Sep 2011
Hi, looks like you need to refresh kartris cache, try to restart kartris from the db admin page, or if you don't have permissions to do that, try to restart your website from iis or hosting control panel.
By simonridley - Thu 8 Sep 2011
Hi Mohammad

I have now tried both restarting IIS and restarting the site from the Admin panel and still have same issue

Simon
By Paul - Thu 8 Sep 2011
I have recorded a bug on this, i tested the latest dev code and get an issue with featuredproducts, though not the same issue. Looking at this now.
By Paul - Thu 8 Sep 2011
I've found a fix which works locally. It seems the following code fails if there are no featured products (in Admin/_FeaturedProducts.aspx.vb)


    Private Sub LoadFeaturedProducts()
        mvwFeaturedProducts.SetActiveView(viwProductList)
        lbxFeaturedProducts.Items.Clear()
        Dim tblFeaturedProducts As DataTable = ProductsBLL._GetFeaturedProducts(Session("_LANG"))
        If tblFeaturedProducts.Rows.Count = 0 Then mvwFeaturedProducts.SetActiveView(viwNoItems)
        If tblFeaturedProducts.Rows.Count > 0 Then
            tblFeaturedProducts.DefaultView.Sort = "ProductPriority DESC"
        End If
        For Each rowProduct As DataRow In tblFeaturedProducts.Rows
            AddProductToList(rowProduct("ProductID"), rowProduct("ProductName"), rowProduct("ProductPriority"))
        Next
    End Sub


A try/catch sorts the issue:


    Private Sub LoadFeaturedProducts()
        mvwFeaturedProducts.SetActiveView(viwProductList)
        lbxFeaturedProducts.Items.Clear()
        Try
            Dim tblFeaturedProducts As DataTable = ProductsBLL._GetFeaturedProducts(Session("_LANG"))
            If tblFeaturedProducts.Rows.Count = 0 Then mvwFeaturedProducts.SetActiveView(viwNoItems)
            If tblFeaturedProducts.Rows.Count > 0 Then
                tblFeaturedProducts.DefaultView.Sort = "ProductPriority DESC"
            End If
            For Each rowProduct As DataRow In tblFeaturedProducts.Rows
                AddProductToList(rowProduct("ProductID"), rowProduct("ProductName"), rowProduct("ProductPriority"))
            Next
        Catch ex As Exception
            'nothing
        End Try

    End Sub


If you update that file on your site, it should fix the issue.

I'll test a little more and assuming no issues will commit this for 1.3005.