Try These Categories Fix

Posted By jcosmo Fri 15 Jan 2016
Add to Favorites0
Author Message
jcosmo
 Posted Fri 15 Jan 2016
Supreme Being

Supreme Being - (10,485 reputation)Supreme Being - (10,485 reputation)Supreme Being - (10,485 reputation)Supreme Being - (10,485 reputation)Supreme Being - (10,485 reputation)Supreme Being - (10,485 reputation)Supreme Being - (10,485 reputation)Supreme Being - (10,485 reputation)Supreme Being - (10,485 reputation)

Group: Forum Members
Last Active: Tue 16 Feb 2016
Posts: 19, Visits: 117
I tried to turn off Try These Categories by setting frontend.crossselling.trythesecategories to 0. It didn't work, and when I traced through the code to see why I found that the Try These Categories functionality wasn't using this parameter at all for determining how many categories to show. I corrected this through the following changes:

Updated the Stored Procedure to accept and use the number of Categories to display with the following SQL Statement:
ALTER PROCEDURE [dbo].[spKartrisCategories_GetByProductID]
(
@P_ID int,
@LANG_ID tinyint,
@numTryTheseCategories int
)
AS
SET NOCOUNT ON;
SELECT TOP (@numTryTheseCategories) vKartrisTypeCategories.CAT_ID, vKartrisTypeCategories.CAT_Name
FROM vKartrisTypeCategories INNER JOIN
tblKartrisProductCategoryLink ON vKartrisTypeCategories.CAT_ID = tblKartrisProductCategoryLink.PCAT_CategoryID
WHERE (vKartrisTypeCategories.LANG_ID = @LANG_ID) AND (tblKartrisProductCategoryLink.PCAT_ProductID = @P_ID)
GO


Updated the katrisCategoriesData.xsd data adapter to include the new parameter

Updated the CategoriesBLL.vb at line 59 to be:
Public Shared Function GetCategoriesByProductID(ByVal _ProductID As Integer, ByVal _LanguageID As Short, ByVal _numTryTheseCategories As Integer) As DataTable
Return Adptr.GetByProductID(_ProductID, _LanguageID, _numTryTheseCategories)
End Function


Updated the CarryOnShopping.ascx.vb at line 120 to be:
Sub LoadLinkedCategories()


Dim intTryTheseCategories As Integer


Try
intTryTheseCategories = CInt(GetKartConfig("frontend.crossselling.trythesecategories"))
Catch ex As Exception
intTryTheseCategories = 0
End Try


If intTryTheseCategories > 0 Then
'' Add the linked categories to a DataTable
Dim tblCategories As New DataTable
tblCategories = CategoriesBLL.GetCategoriesByProductID(_ProductID, _LanguageID, intTryTheseCategories)


'' If there is no linked categories, then exit this section.
If tblCategories.Rows.Count = 0 Then Exit Sub


'' Bind the linked categories in to rptLinkedCategories, and View its container.
phdLinkedCategories.Visible = True
rptLinkedCategories.DataSource = tblCategories.DefaultView
rptLinkedCategories.DataBind()
Else
''Hide try these categories section
phdLinkedCategories.Visible = False
End If
End Sub


This appears to be a bug fix and not new functionality, so it would be great to see these changes implemented in the next release.

Threaded View

Expand / Collapse

Similar Topics

Expand / Collapse

Reading This Topic

Expand / Collapse

Back To Top