Group: Forum Members
Last Active: Wed 22 Jul 2020
Posts: 153,
Visits: 874
|
Promotion applied to products is showed in product's detail page but customers can't know if there's a promotion on product 'til they enter the product detail because during navigation in parent categories promotions are not evidentiated. So I modified a product template UC to obtain this result.
In aspx page I added a placeholder like the following: <asp:placeHolder ID="phPromo" runat="server" Visible="false"> <div id="promosticker"> <p> PROMO </p> </div> </asp:placeHolder> With CSS I modeled promosticker div to appear like a ribbon at the upper left corner of the user control. In UC's codebehind I added a function to load event that verifies if product is listed in A part of active and running promotions and, depending on that, switches placeholder's visibility on or off. phPromo.Visible = isPromoted(litProductID.text)
And this is the function: Public Shared Function isPromoted(ByVal idprod As Integer) As Boolean Dim promosso As Boolean = False Dim cn = New SqlConnection(ConfigurationManager.ConnectionStrings("KartrisSQLConnection").ConnectionString) Using cn cn.Open() dim strsql as string = "SELECT PP_itemID FROM tblKartrisPromotionParts " & " Left Join tblKartrisPromotions ON tblKartrisPromotionParts.Prom_ID=tblKartrisPromotions.Prom_ID " & " WHERE prom_live = 1 AND pp_partNo ='a' AND pp_ItemType='p' AND GETDATE() >=PROM_startdate AND GEtdate() <= PROM_EndDate " & " And pp_ITEMID = " & idprod dim cmd2 = New SqlCommand(strsql, cn) dim rd as sqlDataReader = cmd2.ExecuteReader() If rd.HasRows Then promosso = True End If End Using Return promosso End Function
I post it here if it can be useful to someone or improved by anyone. When I'll have time I'll extend the verify to product's parent category (so every product belonging to a promoted category will be evidentiated with the ribbon)
Thu 14 Sep 2017 by
Supermac
|