public void GetAllGiftCards() { AspxCommonInfo aspxCommonObj = new AspxCommonInfo(); aspxCommonObj.StoreID = StoreID; aspxCommonObj.PortalID = PortalID; aspxCommonObj.UserName = UserName; aspxCommonObj.CultureName = CultureName; List <LatestItemsInfo> lstGiftItems = AspxItemMgntController.GetAllGiftCards(aspxCommonObj); StringBuilder GiftItems = new StringBuilder(); string modulePath = this.AppRelativeTemplateSourceDirectory; hst = AppLocalized.getLocale(modulePath); string pageExtension = SageFrameSettingKeys.PageExtension; string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName; string aspxRootPath = ResolveUrl("~/"); decimal rate = 1; StoreSettingConfig ssc = new StoreSettingConfig(); decimal additionalCCVR = decimal.Parse(ssc.GetStoreSettingsByKey(StoreSetting.AdditionalCVR, StoreID, PortalID, CultureName)); string MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, StoreID, PortalID, CultureName); if (HttpContext.Current.Session["CurrencyRate"] != null) { if (Session["CurrencyCode"].ToString() != MainCurrency) { decimal rate1 = decimal.Parse(Session["CurrencyRate"].ToString()); rate = Math.Round(rate1 + (rate1 * additionalCCVR / 100), 4); } else { rate = decimal.Parse(Session["CurrencyRate"].ToString()); } } if (lstGiftItems != null && lstGiftItems.Count > 0) { foreach (LatestItemsInfo item in lstGiftItems) { string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.ImagePath; if (item.ImagePath == "") { item.ImagePath = DefaultImagePath; } if (item.AlternateText == "") { item.AlternateText = item.Name; } if (item.AlternateImagePath == "") { item.AlternateImagePath = item.ImagePath; } if ((lstGiftItems.IndexOf(item) + 1) % NoOfItemsInARow == 0) { GiftItems.Append("<div class=\"cssClassProductsBox cssClassNoMargin\">"); } else { GiftItems.Append("<div class=\"cssClassProductsBox\">"); } string itemPrice = Math.Round(double.Parse((item.Price).ToString()), 2).ToString(); string itemPriceRate = Math.Round(double.Parse((item.Price * rate).ToString()), 2).ToString(); var hrefItem = aspxRedirectPath + "item/" + fixedEncodeURIComponent(item.SKU) + pageExtension; GiftItems.Append("<div id=\"productImageWrapID_"); GiftItems.Append(item.ItemID); GiftItems.Append("\" class=\"cssClassProductsBoxInfo\" costvariantItem="); GiftItems.Append(item.IsCostVariantItem); GiftItems.Append(" itemid=\""); GiftItems.Append(item.ItemID); GiftItems.Append("\"><h2>"); GiftItems.Append(item.Name); GiftItems.Append("</h2><h3>"); GiftItems.Append(item.SKU); GiftItems.Append( "</h3><div id=\"divQuickLookonHover\"><div id=\"divitemImage\" class=\"cssClassProductPicture\"><a href=\""); GiftItems.Append(hrefItem); GiftItems.Append("\" ><img id=\""); GiftItems.Append(item.ItemID); GiftItems.Append("\" alt=\""); GiftItems.Append(item.AlternateText); GiftItems.Append("\" title=\""); GiftItems.Append(item.AlternateText); GiftItems.Append("\" data-original=\""); GiftItems.Append(aspxTemplateFolderPath); GiftItems.Append("/images/loader_100x12.gif\" src=\""); GiftItems.Append(aspxRootPath); GiftItems.Append(imagePath.Replace("uploads", "uploads/Medium")); GiftItems.Append("\"></a></div>"); if (item.HidePrice != true) { if (item.ListPrice != null) { string strAmount = Math.Round((double)(item.ListPrice * rate), 2).ToString(); GiftItems.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">"); GiftItems.Append("<p class=\"cssClassProductOffPrice\">"); GiftItems.Append("<span class=\"cssClassFormatCurrency\" value="); GiftItems.Append(Math.Round(double.Parse(item.ListPrice.ToString()), 2).ToString()); GiftItems.Append(">"); GiftItems.Append(strAmount); GiftItems.Append("</span></p><p class=\"cssClassProductRealPrice \" >"); GiftItems.Append("<span class=\"cssClassFormatCurrency\" value="); GiftItems.Append(itemPrice); GiftItems.Append(">"); GiftItems.Append(itemPriceRate); GiftItems.Append("</span></p></div></div>"); } else { GiftItems.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">"); GiftItems.Append("<p class=\"cssClassProductRealPrice \" >"); GiftItems.Append("<span class=\"cssClassFormatCurrency\" value="); GiftItems.Append(itemPrice); GiftItems.Append(">"); GiftItems.Append(itemPriceRate); GiftItems.Append("</span></p></div></div>"); } } else { GiftItems.Append("<div class=\"cssClassProductPriceBox\"></div>"); } GiftItems.Append("<div class=\"cssClassProductDetail\"><p><a href=\""); GiftItems.Append(aspxRedirectPath); GiftItems.Append("item/"); GiftItems.Append(item.SKU); GiftItems.Append(pageExtension); GiftItems.Append("\">"); GiftItems.Append(getLocale("Details")); GiftItems.Append("</a></p></div>"); GiftItems.Append("<div class=\"sfQuickLook\" style=\"display:none\">"); GiftItems.Append("<img itemId=\""); GiftItems.Append(item.ItemID); GiftItems.Append("\" sku=\""); GiftItems.Append(item.SKU); GiftItems.Append("\" src=\""); GiftItems.Append(aspxTemplateFolderPath); GiftItems.Append("/images/QV_Button.png\" rel=\"popuprel\" />"); GiftItems.Append("</div>"); GiftItems.Append("</div>"); GiftItems.Append("<div class=\"sfButtonwrapper\">"); if (AllowWishListLatestItem.ToLower() == "true") { if (GetCustomerID > 0 && GetUsername.ToLower() != "anonymoususer") { GiftItems.Append("<div class=\"cssClassWishListButton\">"); GiftItems.Append( "<button type=\"button\" id=\"addWishList\" onclick=GiftCardsAll.CheckWishListUniqueness("); GiftItems.Append(item.ItemID); GiftItems.Append(",'"); GiftItems.Append(item.SKU); GiftItems.Append("',this);><span><span><span>+</span>"); GiftItems.Append(getLocale("Wishlist")); GiftItems.Append("</span></span></button></div>"); } else { GiftItems.Append("<div class=\"cssClassWishListButton\">"); GiftItems.Append( "<button type=\"button\" id=\"addWishList\" onclick=\"AspxCommerce.RootFunction.Login();\">"); GiftItems.Append("<span><span><span>+</span>"); GiftItems.Append(getLocale("Wishlist")); GiftItems.Append("</span></span></button></div>"); } } if (AllowAddToCompareLatest.ToLower() == "true") { GiftItems.Append("<div class=\"cssClassCompareButton\">"); GiftItems.Append("<input type=\"checkbox\" id=\"compare-"); GiftItems.Append(item.ItemID); GiftItems.Append("\" onclick=GiftCardsAll.AddItemsToCompare("); GiftItems.Append(item.ItemID); GiftItems.Append(",'"); GiftItems.Append(item.SKU); GiftItems.Append("',this);><span>"); GiftItems.Append(getLocale("Compare")); GiftItems.Append("</span></input></div>"); } GiftItems.Append("</div>"); GiftItems.Append("<div class=\"cssClassclear\"></div>"); string itemSKU = item.SKU; string itemName = item.Name; if (AllowOutStockPurchase.ToLower() == "false") { if (item.IsOutOfStock == true) { GiftItems.Append( "</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper cssClassOutOfStock\">"); GiftItems.Append("<button type=\"button\"><span>"); GiftItems.Append(getLocale("Out Of Stock")); GiftItems.Append("</span></button></div></div>"); } else { GiftItems.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\">"); GiftItems.Append("<button type=\"button\" id=\"addtoCart\" title="); GiftItems.Append(itemName); GiftItems.Append(" onclick=GiftCardsAll.AddToCartToJS("); GiftItems.Append(item.ItemID); GiftItems.Append(","); GiftItems.Append(itemPrice); GiftItems.Append(",'"); GiftItems.Append(itemSKU); GiftItems.Append("',"); GiftItems.Append(1); GiftItems.Append(",this);><span><span>"); GiftItems.Append(getLocale("Add to cart")); GiftItems.Append("</span></span></button></div></div>"); } } else { GiftItems.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\">"); GiftItems.Append("<button type=\"button\" id=\"addtoCart\" title="); GiftItems.Append(itemName); GiftItems.Append(" onclick=GiftCardsAll.AddToCartToJS("); GiftItems.Append(item.ItemID); GiftItems.Append(","); GiftItems.Append(itemPrice); GiftItems.Append(",'"); GiftItems.Append(itemSKU); GiftItems.Append("',"); GiftItems.Append(1); GiftItems.Append(",this); ><span><span>"); GiftItems.Append(getLocale("Add to cart")); GiftItems.Append("</span></span></button></div></div>"); } GiftItems.Append("</div>"); } } else { GiftItems.Append("<span class=\"cssClassNotFound\">"); GiftItems.Append(getLocale("No items found!")); GiftItems.Append("</span>"); } divGiftCards.InnerHtml = GiftItems.ToString(); }
private void GetLatestItemsByCount() { AspxCommonInfo aspxCommonObj = new AspxCommonInfo(); aspxCommonObj.StoreID = StoreID; aspxCommonObj.PortalID = PortalID; aspxCommonObj.UserName = UserName; aspxCommonObj.CultureName = CultureName; List <LatestItemsInfo> latestItemsInfo = AspxItemMgntController.GetLatestItemsByCount(aspxCommonObj, NoOfLatestItems); StringBuilder RecentItemContents = new StringBuilder(); string modulePath = this.AppRelativeTemplateSourceDirectory; hst = AppLocalized.getLocale(modulePath); string pageExtension = SageFrameSettingKeys.PageExtension; string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName; string aspxRootPath = ResolveUrl("~/"); decimal rate = 1; StoreSettingConfig ssc = new StoreSettingConfig(); decimal additionalCCVR = decimal.Parse(ssc.GetStoreSettingsByKey(StoreSetting.AdditionalCVR, StoreID, PortalID, CultureName)); string MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, StoreID, PortalID, CultureName); if (HttpContext.Current.Session["CurrencyRate"] != null) { if (Session["CurrencyCode"].ToString() != MainCurrency) { decimal rate1 = decimal.Parse(Session["CurrencyRate"].ToString()); rate = Math.Round(rate1 + (rate1 * additionalCCVR / 100), 4); } else { rate = decimal.Parse(Session["CurrencyRate"].ToString()); } } if (latestItemsInfo != null && latestItemsInfo.Count > 0) { foreach (LatestItemsInfo item in latestItemsInfo) { string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.ImagePath; string altImagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.AlternateImagePath; if (item.ImagePath == "") { imagePath = DefaultImagePath; } if (item.AlternateText == "") { item.AlternateText = item.Name; } if (item.AlternateImagePath == "") { altImagePath = imagePath; } string itemPrice = Math.Round(double.Parse((item.Price).ToString()), 2).ToString(); string itemPriceRate = Math.Round(double.Parse((item.Price * rate).ToString()), 2).ToString(); RecentItemContents.Append("<div class=\"cssClassProductsBox\">"); var hrefItem = aspxRedirectPath + "item/" + fixedEncodeURIComponent(item.SKU) + pageExtension; RecentItemContents.Append("<div id=\"productImageWrapID_"); RecentItemContents.Append(item.ItemID); RecentItemContents.Append("\" class=\"cssClassProductsBoxInfo\" costvariantItem="); RecentItemContents.Append(item.IsCostVariantItem); RecentItemContents.Append(" itemid=\""); RecentItemContents.Append(item.ItemID); RecentItemContents.Append("\"><a href=\""); RecentItemContents.Append(hrefItem); RecentItemContents.Append("\" title=\"" + item.Name + "\"><h2>"); string name = string.Empty; if (item.Name.Length > 50) { name = item.Name.Substring(0, 50); int index = 0; index = name.LastIndexOf(' '); name = name.Substring(0, index); name = name + "..."; } else { name = item.Name; } RecentItemContents.Append(name); RecentItemContents.Append("</h2></a><h3>"); RecentItemContents.Append(item.SKU); RecentItemContents.Append("</h3><div class=\"divQuickLookonHover\"><div class=\"divitemImage cssClassProductPicture\"><a href=\""); RecentItemContents.Append(hrefItem); RecentItemContents.Append("\" ><img id=\"img_"); RecentItemContents.Append(item.ItemID); RecentItemContents.Append("\" alt=\""); RecentItemContents.Append(item.AlternateText); RecentItemContents.Append("\" title=\""); RecentItemContents.Append(item.AlternateText); RecentItemContents.Append("\""); RecentItemContents.Append("src=\""); RecentItemContents.Append(aspxRootPath); RecentItemContents.Append(imagePath.Replace("uploads", "uploads/Medium")); RecentItemContents.Append("\" orignalPath=\""); RecentItemContents.Append(imagePath.Replace("uploads", "uploads/Medium")); RecentItemContents.Append("\" altImagePath=\""); RecentItemContents.Append(altImagePath.Replace("uploads", "uploads/Medium")); //RecentItemContents.Append("\" onmouseover='SwapImageOnMouseOver(this.id,\""); //RecentItemContents.Append(aspxRootPath); //RecentItemContents.Append(item.AlternateImagePath.Replace("uploads", "uploads/Medium")); //RecentItemContents.Append("\")' onmouseout='SwapImageOnMouseOut(this.id,\""); //RecentItemContents.Append(aspxRootPath); //RecentItemContents.Append(item.ImagePath.Replace("uploads", "uploads/Medium")); RecentItemContents.Append("\"/></a></div>"); if (item.HidePrice != true) { if (item.ListPrice != null) { string strAmount = Math.Round((double)(item.ListPrice * rate), 2).ToString(); RecentItemContents.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">"); RecentItemContents.Append("<p class=\"cssClassProductOffPrice\">"); //RecentItemContents.Append(getLocale("Regular Price :")); RecentItemContents.Append("<span class=\"cssClassFormatCurrency\" value=\""); RecentItemContents.Append(Math.Round(double.Parse(item.ListPrice.ToString()), 2).ToString()); RecentItemContents.Append("\">"); RecentItemContents.Append(strAmount); RecentItemContents.Append("</span></p><p class=\"cssClassProductRealPrice \" >"); //RecentItemContents.Append(getLocale("Our Offer :")); RecentItemContents.Append("<span class=\"cssClassFormatCurrency\" value=\""); RecentItemContents.Append(itemPrice); RecentItemContents.Append("\">"); RecentItemContents.Append(itemPriceRate); RecentItemContents.Append("</span></p></div></div>"); } else { RecentItemContents.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">"); RecentItemContents.Append("<p class=\"cssClassProductRealPrice \" >"); //RecentItemContents.Append(getLocale("Our Offer :")); RecentItemContents.Append("<span class=\"cssClassFormatCurrency\" value=\""); RecentItemContents.Append(itemPrice); RecentItemContents.Append("\">"); RecentItemContents.Append(itemPriceRate); RecentItemContents.Append("</span></p></div></div>"); } } else { RecentItemContents.Append("<div class=\"cssClassProductPriceBox\"></div>"); } RecentItemContents.Append("<div class=\"cssClassProductDetail\"><p><a href=\""); RecentItemContents.Append(aspxRedirectPath); RecentItemContents.Append("item/"); RecentItemContents.Append(item.SKU); RecentItemContents.Append(pageExtension); RecentItemContents.Append("\">"); RecentItemContents.Append(getLocale("Details")); RecentItemContents.Append("</a></p></div>"); RecentItemContents.Append("<div class=\"sfQuickLook\" style=\"display:none\">"); RecentItemContents.Append("<img itemId=\""); RecentItemContents.Append(item.ItemID); RecentItemContents.Append("\" sku=\""); RecentItemContents.Append(item.SKU); RecentItemContents.Append("\" src=\""); RecentItemContents.Append(aspxTemplateFolderPath); RecentItemContents.Append("/images/QV_Button.png\" alt=\"\" rel=\"popuprel\" />"); RecentItemContents.Append("</div>"); RecentItemContents.Append("</div>"); RecentItemContents.Append("<div class=\"sfButtonwrapper\">"); if (AllowWishListLatestItem.ToLower() == "true") { if (GetCustomerID > 0 && GetUsername.ToLower() != "anonymoususer") { RecentItemContents.Append("<div class=\"cssClassWishListButton\">"); RecentItemContents.Append("<button type=\"button\" class=\"addWishList\" onclick=\"LatestItems.CheckWishListUniqueness("); RecentItemContents.Append(item.ItemID); RecentItemContents.Append(",'"); RecentItemContents.Append(item.SKU); RecentItemContents.Append("',this);\"><span><span><span>+</span>"); RecentItemContents.Append(getLocale("Wishlist")); RecentItemContents.Append("</span></span></button></div>"); } else { RecentItemContents.Append("<div class=\"cssClassWishListButton\">"); RecentItemContents.Append("<button type=\"button\" class=\"addWishList\" onclick=\"AspxCommerce.RootFunction.Login();\">"); RecentItemContents.Append("<span><span><span>+</span>"); RecentItemContents.Append(getLocale("Wishlist")); RecentItemContents.Append("</span></span></button></div>"); } } //RecentItemContents+="<input type=\"button\" id=\"addWishList\" value=\"Add To Wishlist\" onclick='AddToWishList(" + item.ItemID + ");'/>"; //RecentItemContents += "<div class=\"cssClassWishListDetail\"><p><a href='addtowishlist.aspx?itemId="+ item.ItemID + "'>Add to Wishlist</a></p>"; if (AllowAddToCompareLatest.ToLower() == "true") { RecentItemContents.Append("<div class=\"cssClassCompareButton\">"); RecentItemContents.Append("<label><input type=\"checkbox\" id=\"compare-"); RecentItemContents.Append(item.ItemID); RecentItemContents.Append("\" onclick=\"LatestItems.AddItemsToCompare("); RecentItemContents.Append(item.ItemID); RecentItemContents.Append(",'"); RecentItemContents.Append(item.SKU); RecentItemContents.Append("',this);\"/><span>"); RecentItemContents.Append(getLocale("Compare")); RecentItemContents.Append("</span></label></div>"); } RecentItemContents.Append("</div>"); RecentItemContents.Append("<div class=\"cssClassclear\"></div>"); string itemSKU = item.SKU; string itemName = item.Name; if (AllowOutStockPurchase.ToLower() == "false") { if (item.IsOutOfStock == true) { RecentItemContents.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper cssClassOutOfStock\">"); RecentItemContents.Append("<button type=\"button\"><span>"); RecentItemContents.Append(getLocale("Out Of Stock")); RecentItemContents.Append("</span></button></div></div>"); } else { // RecentItemContents += "</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\"><a href=\"#\" title=" + itemName + " onclick='LatestItems.AddToCartToJS(" + item.ItemID + "," + item.Price.toFixed(2) + "," + itemSKU + "," + 1 + ");'><span>Add to cart</span></a></div></div>"; RecentItemContents.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\">"); RecentItemContents.Append("<button type=\"button\" class=\"addtoCart\" title=\""); RecentItemContents.Append(itemName); RecentItemContents.Append("\" onclick=\"LatestItems.AddToCartToJS("); RecentItemContents.Append(item.ItemID); RecentItemContents.Append(","); RecentItemContents.Append(itemPrice); RecentItemContents.Append(",'"); RecentItemContents.Append(itemSKU); RecentItemContents.Append("',"); RecentItemContents.Append(1); RecentItemContents.Append(",this);\"><span><span>"); RecentItemContents.Append(getLocale("Add to cart")); RecentItemContents.Append("</span></span></button></div></div>"); } } else { RecentItemContents.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\">"); RecentItemContents.Append("<button type=\"button\" class=\"addtoCart\" title=\""); RecentItemContents.Append(itemName); RecentItemContents.Append("\" onclick=\"LatestItems.AddToCartToJS("); RecentItemContents.Append(item.ItemID); RecentItemContents.Append(","); RecentItemContents.Append(itemPrice); RecentItemContents.Append(",'"); RecentItemContents.Append(itemSKU); RecentItemContents.Append("',"); RecentItemContents.Append(1); RecentItemContents.Append(",this);\"><span><span>"); RecentItemContents.Append(getLocale("Add to cart")); RecentItemContents.Append("</span></span></button></div></div>"); } RecentItemContents.Append("</div>"); } } else { RecentItemContents.Append("<span class=\"cssClassNotFound\">"); RecentItemContents.Append(getLocale("This store has no items listed yet!")); RecentItemContents.Append("</span>"); } tblRecentItems.InnerHtml = RecentItemContents.ToString(); }
private void BindCategoryItems(CategoryWiseItemInfo item) { string pageExtension = SageFrameSettingKeys.PageExtension; string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName; CatWiseItemContains = new StringBuilder(); string aspxRootPath = ResolveUrl("~/"); decimal rate = 1; RowTotal = item.RowTotal; StoreSettingConfig ssc = new StoreSettingConfig(); decimal additionalCCVR = decimal.Parse(ssc.GetStoreSettingsByKey(StoreSetting.AdditionalCVR, StoreID, PortalID, CultureName)); string MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, StoreID, PortalID, CultureName); if (HttpContext.Current.Session["CurrencyRate"] != null) { if (Session["CurrencyCode"].ToString() != MainCurrency) { decimal rate1 = decimal.Parse(Session["CurrencyRate"].ToString()); rate = Math.Round(rate1 + (rate1 * additionalCCVR / 100), 4); } else { rate = decimal.Parse(Session["CurrencyRate"].ToString()); } } string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.ImagePath; if (item.ImagePath == "") { imagePath = DefaultImagePath; } if (item.AlternateText == "") { item.AlternateText = item.Name; } string itemPrice = Math.Round(double.Parse((item.Price).ToString()), 2).ToString(); string itemPriceRate = Math.Round(double.Parse((item.Price * rate).ToString()), 2).ToString(); string name = string.Empty; if (item.Name.Length > 50) { name = item.Name.Substring(0, 50); int index = 0; index = name.LastIndexOf(' '); name = name.Substring(0, index); name = name + "..."; } else { name = item.Name; } if (item.ItemRowNum <= noOfItemsInCategory) { CatWiseItemContains.Append("<div class=\"classItemsList_" + item.CategoryID + "\">"); CatWiseItemContains.Append("<div class=\"cssClassProductsBox\">"); var hrefItem = aspxRedirectPath + "item/" + fixedEncodeURIComponent(item.SKU) + pageExtension; CatWiseItemContains.Append("<div id=\"productImageWrapID_"); CatWiseItemContains.Append(item.ItemID); CatWiseItemContains.Append("\" class=\"cssClassProductsBoxInfo\" costvariantItem="); CatWiseItemContains.Append(item.IsCostVariantItem); CatWiseItemContains.Append(" itemid=\""); CatWiseItemContains.Append(item.ItemID); CatWiseItemContains.Append("\"><a href=\"" + hrefItem + "\" title=\"" + item.Name + "\"><h2>"); CatWiseItemContains.Append(name); CatWiseItemContains.Append("</h2><h3>"); CatWiseItemContains.Append(item.SKU); CatWiseItemContains.Append("</h3>"); CatWiseItemContains.Append("<div id=\"divitemImage\" class=\"cssClassProductPicture\"><a href=\""); CatWiseItemContains.Append(hrefItem); CatWiseItemContains.Append("\" ><img id=\""); CatWiseItemContains.Append(item.ItemID); CatWiseItemContains.Append("\" alt=\""); CatWiseItemContains.Append(item.AlternateText); CatWiseItemContains.Append("\" title=\""); CatWiseItemContains.Append(item.AlternateText); CatWiseItemContains.Append("\" data-original=\""); CatWiseItemContains.Append(aspxTemplateFolderPath); CatWiseItemContains.Append("/images/loader_100x12.gif\" src=\""); CatWiseItemContains.Append(aspxRootPath); CatWiseItemContains.Append(imagePath.Replace("uploads", "uploads/Medium")); CatWiseItemContains.Append("\"/></a></div>"); if (item.HidePrice != true) { if (item.ListPrice != null) { string listPrice = Math.Round(double.Parse(item.ListPrice.ToString()), 2).ToString(); string strAmount = Math.Round((double)(item.ListPrice * rate), 2).ToString(); CatWiseItemContains.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">"); CatWiseItemContains.Append("<p class=\"cssClassProductOffPrice\">"); //CatWiseItemContains.Append(getLocale("Regular Price :")); CatWiseItemContains.Append("<span class=\"cssClassFormatCurrency\" value="); CatWiseItemContains.Append(listPrice); CatWiseItemContains.Append(">"); CatWiseItemContains.Append(strAmount); CatWiseItemContains.Append("</span></p><p class=\"cssClassProductRealPrice \" >"); //CatWiseItemContains.Append(getLocale("Our Offer :")); CatWiseItemContains.Append("<span class=\"cssClassFormatCurrency\" value="); CatWiseItemContains.Append(itemPrice); CatWiseItemContains.Append(">"); CatWiseItemContains.Append(itemPriceRate); CatWiseItemContains.Append("</span></p></div></div>"); } else { CatWiseItemContains.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">"); CatWiseItemContains.Append("<p class=\"cssClassProductRealPrice \" >"); //CatWiseItemContains.Append(getLocale("Our Offer :")); CatWiseItemContains.Append("<span class=\"cssClassFormatCurrency\" value="); CatWiseItemContains.Append(itemPrice); CatWiseItemContains.Append(">"); CatWiseItemContains.Append(itemPriceRate); CatWiseItemContains.Append("</span></p></div></div>"); } } CatWiseItemContains.Append("<div class=\"cssClassProductDetail\"><p><a href=\""); CatWiseItemContains.Append(aspxRedirectPath); CatWiseItemContains.Append("item/"); CatWiseItemContains.Append(item.SKU); CatWiseItemContains.Append(pageExtension); CatWiseItemContains.Append("\">"); CatWiseItemContains.Append(getLocale("Details")); CatWiseItemContains.Append("</a></p></div>"); CatWiseItemContains.Append("</div>"); CatWiseItemContains.Append("<div class=\"sfButtonwrapper\">"); if (AllowWishListLatestItem.ToLower() == "true") { if (GetCustomerID > 0 && GetUsername.ToLower() != "anonymoususer") { CatWiseItemContains.Append("<div class=\"cssClassWishListButton\">"); CatWiseItemContains.Append("<button type=\"button\" id=\"addWishList\" onclick=categoryWiseItemList.CheckWishListUniqueness("); CatWiseItemContains.Append(item.ItemID); CatWiseItemContains.Append(",'"); CatWiseItemContains.Append(item.SKU); CatWiseItemContains.Append("',this);><span><span><span>+</span>"); CatWiseItemContains.Append(getLocale("Wishlist")); CatWiseItemContains.Append("</span></span></button></div>"); } else { CatWiseItemContains.Append("<div class=\"cssClassWishListButton\">"); CatWiseItemContains.Append( "<button type=\"button\" id=\"addWishList\" onclick=\"AspxCommerce.RootFunction.Login();\">"); CatWiseItemContains.Append("<span><span><span>+</span>"); CatWiseItemContains.Append(getLocale("Wishlist")); CatWiseItemContains.Append("</span></span></button></div>"); } } if (AllowAddToCompareLatest.ToLower() == "true") { CatWiseItemContains.Append("<div class=\"cssClassCompareButton\">"); CatWiseItemContains.Append("<input type=\"checkbox\" id=\"compare-"); CatWiseItemContains.Append(item.ItemID); CatWiseItemContains.Append("\" onclick=categoryWiseItemList.AddItemsToCompare("); CatWiseItemContains.Append(item.ItemID); CatWiseItemContains.Append(",'"); CatWiseItemContains.Append(item.SKU); CatWiseItemContains.Append("',this);><span>"); CatWiseItemContains.Append(getLocale("Compare")); CatWiseItemContains.Append("</span></input></div>"); } CatWiseItemContains.Append("</div>"); CatWiseItemContains.Append("<div class=\"cssClassclear\">"); string itemSKU = item.SKU; string itemName = item.Name; if (AllowOutStockPurchase.ToLower() == "false") { if (item.IsOutOfStock == true) { CatWiseItemContains.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper cssClassOutOfStock\">"); CatWiseItemContains.Append("<button type=\"button\"><span>"); CatWiseItemContains.Append(getLocale("Out Of Stock")); CatWiseItemContains.Append("</span></button></div></div>"); } else { // CatWiseItemContains += "</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\"><a href=\"#\" title=" + itemName + " onclick='categoryWiseItemList.AddToCartToJS(" + item.ItemID + "," + item.Price.toFixed(2) + "," + itemSKU + "," + 1 + ");'><span>Add to cart</span></a></div></div>"; CatWiseItemContains.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\">"); CatWiseItemContains.Append("<button type=\"button\" id=\"addtoCart\" title="); CatWiseItemContains.Append(itemName); CatWiseItemContains.Append(" onclick=categoryWiseItemList.AddToCartToJS("); CatWiseItemContains.Append(item.ItemID); CatWiseItemContains.Append(","); CatWiseItemContains.Append(itemPrice); CatWiseItemContains.Append(",'"); CatWiseItemContains.Append(itemSKU); CatWiseItemContains.Append("',"); CatWiseItemContains.Append(1); CatWiseItemContains.Append(",this);><span><span>"); CatWiseItemContains.Append(getLocale("Add to cart")); CatWiseItemContains.Append("</span></span></button></div></div>"); } } else { CatWiseItemContains.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\">"); CatWiseItemContains.Append("<button type=\"button\" id=\"addtoCart\" title="); CatWiseItemContains.Append(itemName); CatWiseItemContains.Append(" onclick=categoryWiseItemList.AddToCartToJS("); CatWiseItemContains.Append(item.ItemID); CatWiseItemContains.Append(","); CatWiseItemContains.Append(itemPrice); CatWiseItemContains.Append(",'"); CatWiseItemContains.Append(itemSKU); CatWiseItemContains.Append("',"); CatWiseItemContains.Append(1); CatWiseItemContains.Append(",this); ><span><span>"); CatWiseItemContains.Append(getLocale("Add to cart")); CatWiseItemContains.Append("</span></span></button></div></div>"); } CatWiseItemContains.Append("</div></div>"); } else { string viewMore = "<a href=\"" + aspxRedirectPath + "category/" + fixedEncodeURIComponent(item.CategoryName) + pageExtension + "\">" + getLocale("View More") + "</a>"; CatWiseItemContains.Append("<div id=\"divViewMore_" + item.CategoryID + "\" class=\"cssViewMore\">"); CatWiseItemContains.Append(viewMore); CatWiseItemContains.Append("</div>"); } }
private void GetLatestItemAnimation() { AspxCommonInfo aspxCommonObj = new AspxCommonInfo(); aspxCommonObj.StoreID = GetStoreID; aspxCommonObj.PortalID = GetPortalID; aspxCommonObj.UserName = GetUsername; aspxCommonObj.CustomerID = GetCustomerID; aspxCommonObj.CultureName = GetCurrentCultureName; List <LatestItemsInfoAnimation> lstLatestItemsAni = AspxItemMgntController.GetLatestItemsByCountAnimation(aspxCommonObj, NoOfLatestItems); StringBuilder latestAniItemContents = new StringBuilder(); string modulePath = this.AppRelativeTemplateSourceDirectory; hst = AppLocalized.getLocale(modulePath); string pageExtension = SageFrameSettingKeys.PageExtension; string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName; string aspxRootPath = ResolveUrl("~/"); decimal rate = 1; StoreSettingConfig ssc = new StoreSettingConfig(); decimal additionalCCVR = decimal.Parse(ssc.GetStoreSettingsByKey(StoreSetting.AdditionalCVR, aspxCommonObj.StoreID, aspxCommonObj.PortalID, aspxCommonObj.CultureName)); string MainCurrency = ssc.GetStoreSettingsByKey(StoreSetting.MainCurrency, aspxCommonObj.StoreID, aspxCommonObj.PortalID, aspxCommonObj.CultureName); if (HttpContext.Current.Session["CurrencyRate"] != null) { if (Session["CurrencyCode"].ToString() != MainCurrency) { decimal rate1 = decimal.Parse(Session["CurrencyRate"].ToString()); rate = Math.Round(rate1 + (rate1 * additionalCCVR / 100), 4); } else { rate = decimal.Parse(Session["CurrencyRate"].ToString()); } } if (lstLatestItemsAni != null && lstLatestItemsAni.Count > 0) { foreach (LatestItemsInfoAnimation item in lstLatestItemsAni) { string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.ImagePath; if (item.ImagePath == "") { imagePath = DefaultImagePath; } if (item.AlternateText == "") { item.AlternateText = item.Name; } if (item.AlternateImagePath == "") { item.AlternateImagePath = imagePath; } string itemPrice = Math.Round(double.Parse((item.Price).ToString()), 2).ToString(); string itemPriceRate = Math.Round(double.Parse((item.Price * rate).ToString()), 2).ToString(); if ((lstLatestItemsAni.IndexOf(item) + 1) % (NoOfLatestItemsInARow) == 0) { latestAniItemContents.Append("<div class=\"cssClassProductsBox cssClassProductsBoxNoMargin\">"); } else { latestAniItemContents.Append("<div class=\"cssClassProductsBox\">"); } decimal discount = 0; decimal listPrice = Convert.ToDecimal(item.ListPrice); if (listPrice != null && listPrice > 0) { discount = ((Convert.ToDecimal(item.ListPrice) - Convert.ToDecimal(item.Price)) / Convert.ToDecimal(item.ListPrice)) * 100; discount = Math.Round(discount); latestAniItemContents.Append("<div class=\"cssClassSaveDiscount\"><span>" + discount + "% </span><span>Off</span></div>"); } if (AllowAddToCompareLatest.ToLower() == "true") { latestAniItemContents.Append( "<div class=\"cssClassCompareButton\"><input type=\"checkbox\" id=\"compare-" + item.ItemID + "\" onclick='LatestItemAnimation.AddItemsToCompare(" + item.ItemID + ',' + item.SKU + ",this);'>"); latestAniItemContents.Append("<span>" + getLocale("Compare") + "</span></input></div>"); } string hrefItem = aspxRedirectPath + "item/" + fixedEncodeURIComponent(item.SKU) + pageExtension; string name = string.Empty; if (item.Name.Length > 50) { name = item.Name.Substring(0, 50); int index = 0; index = name.LastIndexOf(' '); name = name.Substring(0, index); name = name + "..."; } else { name = item.Name; } latestAniItemContents.Append( "<div id=\"productImageWrapID_" + item.ItemID + "\" class=\"cssClassProductsBoxInfo\" costvariantItem=\"" + item.IsCostVariantItem + "\" itemid=\"" + item.ItemID + "\">"); latestAniItemContents.Append( "<div class=\"cssClassProductPicture\"><a href=\"" + hrefItem + "\" ><img id=\"img_" + item.ItemID + "\" alt=\"" + item.AlternateText + "\" title=\"" + item.AlternateText + "\" src=\"" + aspxRootPath + imagePath.Replace("uploads", "uploads/Medium") + "\"></a>"); latestAniItemContents.Append("<div class=\"cssClassProductInfo\">"); latestAniItemContents.Append("<h5><a href=\"" + hrefItem + "\" title=\"" + item.Name + "\">" + name + "</a></h5>"); string shortDescription = HttpUtility.HtmlDecode(item.ShortDescription); string description = ""; if (shortDescription != "" || shortDescription != null) { if (shortDescription.Length > 100) { description = shortDescription.Substring(0, 100); //description = shortDescription.Substring(0, indexVal); description = description + " ..."; } else { description = shortDescription; } } else { description = ""; } latestAniItemContents.Append("<p>" + HttpUtility.HtmlDecode(description) + "</p>"); int averageRating = item.AverageRating; if (averageRating > 0) { latestAniItemContents.Append("<div class=\"cssClassItemRating\">"); latestAniItemContents.Append(" <span class=\"cssClassRatingTitle\"></span>"); latestAniItemContents.Append( "<table cellspacing=\"0\" cellpadding=\"0\" width=\"100%\" border=\"0\" id=\"tblAverageRating\">"); string rating = bindStarRating(averageRating); latestAniItemContents.Append(rating); latestAniItemContents.Append("</table>"); latestAniItemContents.Append("</div>"); } int viewCount = 0; if (item.ViewCount > 0) { viewCount = item.ViewCount; } latestAniItemContents.Append("<div class=\"cssClassProductPrice\">"); if (!Convert.ToBoolean(item.HidePrice)) { if (item.ListPrice != null) { latestAniItemContents.Append( "<p class=\"cssClassProductOffPrice\"><span class=\"cssClassFormatCurrency\" value=\"" + Math.Round(double.Parse(item.ListPrice.ToString()), 2).ToString() + "\">" + Math.Round((double)(item.ListPrice * rate), 2).ToString() + "</span></p><p class=\"cssClassProductRealPrice \" ><span class=\"cssClassFormatCurrency\" value=\"" + itemPrice + "\">" + itemPriceRate + "</span></p><div class=\"cssViewer\"><span class=\"cssClassView\"></span><span>[" + viewCount + "]</span></div></div>"); } else { latestAniItemContents.Append( "<p class=\"cssClassProductRealPrice \" ><span class=\"cssClassFormatCurrency\" value=\"" + itemPrice + "\">" + itemPriceRate + "</span></p><div class=\"cssViewer\"><span class=\"cssClassView\"></span><span>[" + viewCount + "]</span></div></div>"); } } latestAniItemContents.Append("<div class=\"sfButtonwrapper\">"); string itemSKU = "\"" + item.SKU + "\""; string itemName = item.Name; if (AllowWishListLatestItem.ToLower() == "true") { if (aspxCommonObj.CustomerID > 0 && aspxCommonObj.UserName.ToLower() != "anonymoususer") { latestAniItemContents.Append( "<div class=\"cssClassWishListButton\"><button type=\"button\" onclick='LatestItemAnimation.CheckWishListUniqueness(" + item.ItemID + ',' + itemSKU + ",this);'><span><span>" + getLocale("Wishlist") + "</span></span></button></div>"); } else { latestAniItemContents.Append( "<div class=\"cssClassWishListButton\"><button type=\"button\" onclick='AspxCommerce.RootFunction.Login();'><span><span>" + getLocale("Wishlist") + "</span></span></button></div>"); } } if (AllowOutStockPurchase.ToLower() == "false") { if (Convert.ToBoolean(item.IsOutOfStock)) { latestAniItemContents.Append( "<div class=\"cssClassAddtoCard1 cssClassOutOfStock\"><button type=\"button\"><span>" + getLocale("Out Of Stock") + "</span></button></div>"); } else { latestAniItemContents.Append("<div class=\"cssClassAddtoCard1\"><button type=\"button\" title=\"" + itemName + "\" onclick='LatestItemAnimation.AddToCartToJS(" + item.ItemID + "," + itemPrice + "," + itemSKU + "," + 1 + ",this);'><span><span>" + getLocale("Add to cart") + "</span></span></button></div>"); } } else { latestAniItemContents.Append("<div class=\"cssClassAddtoCard1\"><button type=\"button\" title=\"" + itemName + "\" onclick='LatestItemAnimation.AddToCartToJS(" + item.ItemID + "," + itemPrice + "," + itemSKU + "," + 1 + ",this);'><span><span>" + getLocale("Add to cart") + "</span></span></button></div>"); } latestAniItemContents.Append("</div>"); latestAniItemContents.Append("</div>"); latestAniItemContents.Append("</div>"); latestAniItemContents.Append("</div></div>"); } string script = "$('input.star').rating({ split: 2 });"; latestAniItemContents.Append(GetStringScript(script)); divBookItemsContentServer.InnerHtml = latestAniItemContents.ToString(); } else { latestAniItemContents.Append("<span class=\"cssClassNotFound\">"); latestAniItemContents.Append(getLocale("This store has no items listed yet!")); latestAniItemContents.Append("</span>"); divBookItemsContentServer.InnerHtml = latestAniItemContents.ToString(); } }