コード例 #1
0
 private void GetWishListItemsSettig(AspxCommonInfo aspxCommonObj)
 {
     WishItemController wic = new WishItemController();
     WishItemsSettingInfo objWishItemSetting = wic.GetWishItemsSetting(aspxCommonObj);
     if (objWishItemSetting != null)
     {
         NoOfRecentAddedWishItems = objWishItemSetting.NoOfRecentAddedWishItems;
         WishListURL = objWishItemSetting.WishListPageName;
     }
 }
コード例 #2
0
    private void GetWishListItemsSettig()
    {
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = StoreID;
        aspxCommonObj.PortalID    = PortalID;
        aspxCommonObj.CultureName = CultureName;
        WishItemController   wic = new WishItemController();
        WishItemsSettingInfo objWishItemSetting = wic.GetWishItemsSetting(aspxCommonObj);

        if (objWishItemSetting != null)
        {
            EnableWishList      = objWishItemSetting.IsEnableWishList;
            ShowImageInWishlist = objWishItemSetting.IsEnableImageInWishlist;
        }
    }
コード例 #3
0
    private void GetWishListItemsSettig()
    {
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = StoreID;
        aspxCommonObj.PortalID    = PortalID;
        aspxCommonObj.CultureName = CultureName;
        WishItemController   wic = new WishItemController();
        WishItemsSettingInfo objWishItemSetting = wic.GetWishItemsSetting(aspxCommonObj);

        if (objWishItemSetting != null)
        {
            AllowWishItemList        = objWishItemSetting.IsEnableWishList;
            NoOfRecentAddedWishItems = objWishItemSetting.NoOfRecentAddedWishItems;
            WishListURL = objWishItemSetting.WishListPageName;
        }
    }
コード例 #4
0
    private void GetWishListItemsSettig(AspxCommonInfo aspxCommonObj)
    {
        JavaScriptSerializer json_serializer    = new JavaScriptSerializer();
        WishItemController   wic                = new WishItemController();
        WishItemsSettingInfo objWishItemSetting = wic.GetWishItemsSetting(aspxCommonObj);

        if (objWishItemSetting != null)
        {
            object obj = new
            {
                IsEnableImageInWishlist  = objWishItemSetting.IsEnableImageInWishlist,
                NoOfRecentAddedWishItems = objWishItemSetting.NoOfRecentAddedWishItems,
                WishListPageName         = objWishItemSetting.WishListPageName,
                WishItemsModulePath      = WishItemsModulePath
            };
            wishItemsSettings = json_serializer.Serialize(obj);
        }
    }
コード例 #5
0
    public void BindWishListItem()
    {
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = StoreID;
        aspxCommonObj.PortalID    = PortalID;
        aspxCommonObj.UserName    = UserName;
        aspxCommonObj.CultureName = CultureName;
        string modulePath             = this.AppRelativeTemplateSourceDirectory;
        string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName;
        string aspxRootPath           = ResolveUrl("~/");

        hst = AppLocalized.getLocale(modulePath);
        string pageExtension = SageFrameSettingKeys.PageExtension;

        var count = 10;
        var isAll = "1";
        int limit = 5;        int offset = 1;
        int sortBy = 1;        WishItemController controller = new WishItemController();
        List <WishItemsInfo> lstWishList = controller.GetWishItemList(offset, limit, aspxCommonObj, isAll, count, sortBy);
        StringBuilder        wishListStringBld = new StringBuilder();

        if (lstWishList != null && lstWishList.Count > 0)
        {
            SortByList();
            wishListStringBld.Append("<thead>");
            wishListStringBld.Append("<tr class=\"cssClassCommonCenterBoxTableHeading\">");
            wishListStringBld.Append(
                "<th class=\"cssClassWishItemChkbox\"> <input type=\"checkbox\" id=\"chkHeading\"/></th>");
            if (ShowImageInWishlist)
            {
                wishListStringBld.Append(
                    "<th class=\"cssClassWishItemImg\"> <label class=\"sfLocale\">Image</label></th>");
            }
            wishListStringBld.Append(
                "<th class=\"cssClassWishItemDetails\"><label id=\"lblItem\" class=\"sfLocale\">Item Details and Comment</label></th>");
            wishListStringBld.Append(
                "<th class=\"row-variants\"><label id=\"lblVariant\" class=\"sfLocale\">Variants</label></th>");
            if (AllowAddToCart.ToLower() == "true")
            {
                wishListStringBld.Append(
                    "<th class=\"cssClassAddToCart\"><span id=\"lblAddToCart\" class=\"sfLocale\">Add To Cart</span></th>");
            }
            wishListStringBld.Append("<th class=\"cssClassDelete\"></th>");
            wishListStringBld.Append("</tr></thead>");
            wishListStringBld.Append("<tbody>");
            ArrayLength = lstWishList.Count;
            foreach (var response in lstWishList)
            {
                RowTotal = response.RowTotal;
                string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + response.ImagePath;
                if (response.ImagePath == "")
                {
                    imagePath = NoImageWishList;
                }
                else if (response.AlternateText == "")
                {
                    response.AlternateText = response.ItemName;
                    //Resize Image Dynamically
                    InterceptImageController.ImageBuilder(response.ImagePath, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
                }
                else
                {
                    //Resize Image Dynamically
                    InterceptImageController.ImageBuilder(response.ImagePath, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
                }
                JavaScriptSerializer ser = new JavaScriptSerializer();
                string WishDate = (Convert.ToDateTime(response.WishDate)).ToShortDateString();
                var    itemSKU = ser.Serialize(response.SKU);                var cosVaraint = ser.Serialize(response.CostVariantValueIDs);
                var    href = "";
                var    cartUrl = "";
                if (response.CostVariantValueIDs == "")
                {
                    cartUrl = "#";
                    href    = aspxRedirectPath + "item/" + response.SKU + pageExtension;
                }
                else
                {
                    cartUrl = aspxRedirectPath + "item/" + response.SKU + pageExtension + "?varId=" +
                              response.CostVariantValueIDs + "";
                    href = aspxRedirectPath + "item/" + response.SKU + pageExtension + "?varId=" +
                           response.CostVariantValueIDs + "";
                }
                StringBuilder dataContent = new StringBuilder();
                dataContent.Append("data-class=\"addtoCart\" data-type=\"button\" data-addtocart=\"");
                dataContent.Append("addtocart");
                dataContent.Append(response.ItemID);
                dataContent.Append("\" data-title=\"");
                dataContent.Append(response.ItemName);
                dataContent.Append("\" data-onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                dataContent.Append(response.ItemID);
                dataContent.Append(",");
                dataContent.Append(response.Price);
                dataContent.Append(",'");
                dataContent.Append(response.SKU);
                dataContent.Append("',");
                dataContent.Append(1);
                dataContent.Append(",'");
                dataContent.Append(response.IsCostVariantItem);
                dataContent.Append("',this);\"");
                if (lstWishList.IndexOf(response) % 2 == 0)
                {
                    wishListStringBld.Append("<tr class=\"sfEven\" id=\"tr_" + response.ItemID + "\">");
                    wishListStringBld.Append("<td class=\"cssClassWishItemChkbox\">");
                    wishListStringBld.Append("<input type=\"checkbox\" id=\"" + response.WishItemID +
                                             "\" class=\"cssClassWishItem\"/></td>");
                    if (ShowImageInWishlist)
                    {
                        wishListStringBld.Append("<td class=\"cssClassWishItemImg\">");
                        wishListStringBld.Append("<div class=\"cssClassImage\">");
                        wishListStringBld.Append("<img src=\"" + aspxRootPath +
                                                 imagePath.Replace("uploads", "uploads/Small") +
                                                 "\" alt=\"" + response.AlternateText + "\" title=\"" +
                                                 response.AlternateText + "\"/>");
                        wishListStringBld.Append("</div></td>");
                    }
                    wishListStringBld.Append("<td class=\"cssClassWishItemDetails\">");

                    wishListStringBld.Append("<a href=\"" + href + "\">" + response.ItemName + "</a>");
                    wishListStringBld.Append("<div class=\"cssClassWishDate\"><i class='i-calender'></i>" + WishDate + "</div>");
                    wishListStringBld.Append("<div class=\"cssClassWishComment\">");
                    wishListStringBld.Append("<textarea maxlength=\"600\" onkeyup=\"" +
                                             "WishItem.ismaxlength(this)" + "\" id=\"comment_" +
                                             response.WishItemID + "\" class=\"comment\">" + response.Comment +
                                             "</textarea></div></td>");
                    wishListStringBld.Append(
                        "<td><input type=\"hidden\" name=\"hdnCostVariandValueIDS\" value=" + cosVaraint + "/>");
                    wishListStringBld.Append("<span>" + response.ItemCostVariantValue + "</span></td>");
                    if (AllowAddToCart.ToLower() == "true")
                    {
                        if (AllowOutStockPurchase.ToLower() == "false")
                        {
                            if (response.IsOutOfStock != null && (bool)response.IsOutOfStock)
                            {
                                wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                                if (response.ItemTypeID == 5)
                                {
                                    wishListStringBld.Append("<p class=\"cssClassGroupPriceWrapper\">" + getLocale("Starting At "));
                                    wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                             decimal.Parse(response.Price).ToString("N2") + "</span></p>");
                                }
                                else
                                {
                                    wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                             decimal.Parse(response.Price).ToString("N2") + "</span>");
                                }
                                wishListStringBld.Append("<div data-ItemTypeID=\"" + response.ItemTypeID + "\" data-ItemID=\"" + response.ItemID + "\"" + dataContent + " class=\"sfButtonwrapper cssClassOutOfStock\">");
                                wishListStringBld.Append("<span class=\"cssClassOutStock\">" + getLocale("Out Of Stock") +
                                                         "</span></div></td>");
                            }
                            else
                            {
                                wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                                if (response.ItemTypeID == 5)
                                {
                                    wishListStringBld.Append("<p class=\"cssClassGroupPriceWrapper\">" + getLocale("Starting At "));
                                    wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                             decimal.Parse(response.Price).ToString("N2") + "</span></p>");
                                }
                                else
                                {
                                    wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                             decimal.Parse(response.Price).ToString("N2") + "</span>");
                                }

                                wishListStringBld.Append("<div data-ItemTypeID=\"" + response.ItemTypeID + "\"data-ItemID=\"" + response.ItemID + "\"" + dataContent + " class=\"sfButtonwrapper\">");
                                wishListStringBld.Append("<label class=\"i-cart cssClassCartLabel cssClassGreenBtn\"><button type=\"button\" class=\"addtoCart\"");
                                wishListStringBld.Append("addtocart=\"");
                                wishListStringBld.Append("addtocart");
                                wishListStringBld.Append(response.ItemID);
                                wishListStringBld.Append("\" title=\"");
                                wishListStringBld.Append(response.ItemName);

                                wishListStringBld.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                                wishListStringBld.Append(response.ItemID + ",");
                                wishListStringBld.Append(response.Price + ",");
                                wishListStringBld.Append("'" + response.SKU + "'" + "," + 1);
                                wishListStringBld.Append(",'");
                                wishListStringBld.Append(response.IsCostVariantItem);
                                wishListStringBld.Append("',this);\"><span>");
                                wishListStringBld.Append(getLocale("Cart +"));
                                wishListStringBld.Append("</span></button></label></div></td>");
                            }
                        }
                        else
                        {
                            wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                            if (response.ItemTypeID == 5)
                            {
                                wishListStringBld.Append("<p class=\"cssClassGroupPriceWrapper\">" + getLocale("Starting At "));
                                wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                         decimal.Parse(response.Price).ToString("N2") + "</span></p>");
                            }
                            else
                            {
                                wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                         decimal.Parse(response.Price).ToString("N2") + "</span>");
                            }
                            wishListStringBld.Append("<div data-ItemTypeID=\"" + response.ItemTypeID + "\" data-ItemID=\"" + response.ItemID + "\"" + dataContent + " class=\"sfButtonwrapper\">");
                            wishListStringBld.Append("<label class=\"i-cart cssClassCartLabel cssClassGreenBtn\"><button type=\"button\" class=\"addtoCart\"");
                            wishListStringBld.Append("addtocart=\"");
                            wishListStringBld.Append("addtocart");
                            wishListStringBld.Append(response.ItemID);
                            wishListStringBld.Append("\" title=\"");
                            wishListStringBld.Append(response.ItemName);

                            wishListStringBld.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                            wishListStringBld.Append(response.ItemID + ",");
                            wishListStringBld.Append(response.Price + ",");
                            wishListStringBld.Append("'" + response.SKU + "'" + "," + 1);
                            wishListStringBld.Append(",'");
                            wishListStringBld.Append(response.IsCostVariantItem);
                            wishListStringBld.Append("',this);\"><span>");
                            wishListStringBld.Append(getLocale("Cart +"));
                            wishListStringBld.Append("</span></button></label></div></td>");
                        }
                    }
                    wishListStringBld.Append("<td class=\"cssClassDelete\">");
                    wishListStringBld.Append("<a onclick=\"WishItem.Delete(" + response.WishItemID +
                                             ")\"><i class='i-delete'></i></a>");
                    wishListStringBld.Append("</td></tr>");
                }

                else
                {
                    wishListStringBld.Append("<tr class=\"sfOdd\" id=\"tr_" + response.ItemID + "\">");
                    wishListStringBld.Append("<td class=\"cssClassWishItemChkbox\">");
                    wishListStringBld.Append("<input type=\"checkbox\" id=\"" + response.WishItemID +
                                             "\" class=\"cssClassWishItem\"/></td>");
                    if (ShowImageInWishlist)
                    {
                        wishListStringBld.Append("<td class=\"cssClassWishItemImg\">");
                        wishListStringBld.Append("<div class=\"cssClassImage\">");
                        wishListStringBld.Append("<img src=\"" + aspxRootPath +
                                                 imagePath.Replace("uploads", "uploads/Small") +
                                                 "\" alt=\"" + response.AlternateText + "\" title=\"" +
                                                 response.AlternateText + "\"/>");
                        wishListStringBld.Append("</div></td>");
                    }
                    wishListStringBld.Append("<td class=\"cssClassWishItemDetails\">");
                    wishListStringBld.Append("<a href=\"" + href + "\">" + response.ItemName + "</a>");
                    wishListStringBld.Append("<div class=\"cssClassWishDate\"><i class='i-calender'></i>" + WishDate + "</div>");
                    wishListStringBld.Append("<div class=\"cssClassWishComment\">");
                    wishListStringBld.Append("<textarea maxlength=\"600\" onkeyup=\"" +
                                             "WishItem.ismaxlength(this)" + "\" id=\"comment_" +
                                             response.WishItemID + "\" class=\"comment\">" + response.Comment +
                                             "</textarea></div></td>");
                    wishListStringBld.Append(
                        "<td><input type=\"hidden\" name=\"hdnCostVariandValueIDS\" value=" + cosVaraint + "/>");
                    wishListStringBld.Append("<span>" + response.ItemCostVariantValue + "</span></td>");
                    if (AllowAddToCart.ToLower() == "true")
                    {
                        if (AllowOutStockPurchase.ToLower() == "false")
                        {
                            if (response.IsOutOfStock != null && (bool)response.IsOutOfStock)
                            {
                                wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                                if (response.ItemTypeID == 5)
                                {
                                    wishListStringBld.Append("<p class=\"cssClassGroupPriceWrapper\">" + getLocale("Starting At "));
                                    wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                             decimal.Parse(response.Price).ToString("N2") + "</span></p>");
                                }
                                else
                                {
                                    wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                             decimal.Parse(response.Price).ToString("N2") + "</span>");
                                }
                                wishListStringBld.Append("<div data-ItemTypeID=\"" + response.ItemTypeID + "\" data-ItemID=\"" + response.ItemID + "\"" + dataContent + " class=\"sfButtonwrapper cssClassOutOfStock\">");
                                wishListStringBld.Append("<span class=\"cssClassOutStock\">" + getLocale("Out Of Stock") +
                                                         "</span></div></td>");
                            }
                            else
                            {
                                wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                                if (response.ItemTypeID == 5)
                                {
                                    wishListStringBld.Append("<p class=\"cssClassGroupPriceWrapper\">" + getLocale("Starting At "));
                                    wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                             decimal.Parse(response.Price).ToString("N2") + "</span></p>");
                                }
                                else
                                {
                                    wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                             decimal.Parse(response.Price).ToString("N2") + "</span>");
                                }
                                wishListStringBld.Append("<div data-ItemTypeID=\"" + response.ItemTypeID + "\" data-ItemID=\"" + response.ItemID + "\"" + dataContent + " class=\"sfButtonwrapper\">");
                                wishListStringBld.Append("<label class=\"i-cart cssClassCartLabel cssClassGreenBtn\"><button type=\"button\" class=\"addtoCart\"");
                                wishListStringBld.Append("addtocart=\"");
                                wishListStringBld.Append("addtocart");
                                wishListStringBld.Append(response.ItemID);
                                wishListStringBld.Append("\" title=\"");
                                wishListStringBld.Append(response.ItemName);

                                wishListStringBld.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                                wishListStringBld.Append(response.ItemID + ",");
                                wishListStringBld.Append(response.Price + ",");
                                wishListStringBld.Append("'" + response.SKU + "'" + "," + 1);
                                wishListStringBld.Append(",'");
                                wishListStringBld.Append(response.IsCostVariantItem);
                                wishListStringBld.Append("',this);\"><span>");
                                wishListStringBld.Append(getLocale("Cart +"));
                                wishListStringBld.Append("</span></button></label></div></td>");
                            }
                        }
                        else
                        {
                            wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                            if (response.ItemTypeID == 5)
                            {
                                wishListStringBld.Append("<p class=\"cssClassGroupPriceWrapper\">" + getLocale("Starting At "));
                                wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                         decimal.Parse(response.Price).ToString("N2") + "</span></p>");
                            }
                            else
                            {
                                wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                         decimal.Parse(response.Price).ToString("N2") + "</span>");
                            }
                            wishListStringBld.Append("<div data-ItemTypeID=\"" + response.ItemTypeID + "\" data-ItemID=\"" + response.ItemID + "\"" + dataContent + " class=\"sfButtonwrapper\">");
                            wishListStringBld.Append("<label class=\"i-cart cssClassCartLabel cssClassGreenBtn\"><button type=\"button\" class=\"addtoCart\"");
                            wishListStringBld.Append("addtocart=\"");
                            wishListStringBld.Append("addtocart");
                            wishListStringBld.Append(response.ItemID);
                            wishListStringBld.Append("\" title=\"");
                            wishListStringBld.Append(response.ItemName);

                            wishListStringBld.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                            wishListStringBld.Append(response.ItemID + ",");
                            wishListStringBld.Append(response.Price + ",");
                            wishListStringBld.Append("'" + response.SKU + "'" + "," + 1);
                            wishListStringBld.Append(",'");
                            wishListStringBld.Append(response.IsCostVariantItem);
                            wishListStringBld.Append("',this);\"><span>");
                            wishListStringBld.Append(getLocale("Cart +"));
                            wishListStringBld.Append("</span></button></label></div></td>");
                        }
                    }
                    wishListStringBld.Append("<td class=\"cssClassDelete\">");
                    wishListStringBld.Append("<a onclick=\"WishItem.Delete(" + response.WishItemID +
                                             ")\"><i class='i-delete'></i></a>");
                    wishListStringBld.Append("</td></tr>");
                }
            }

            wishListStringBld.Append("</tbody>");
            wishListStringBld.Append(GetStringScript("$('.cssClassImage img[title]').tipsy({ gravity: 'n' });"));
            StringBuilder wishLstButtonBdl = new StringBuilder();
            wishLstButtonBdl.Append("<label class='i-wishlist cssClassGreenBtn'><button type=\"button\" id=\"shareWishList\">");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Share Wishlist</span></button></label>");
            wishLstButtonBdl.Append(
                "<label class='i-update cssClassDarkBtn'><button type=\"button\" id=\"updateWishList\" onclick=\"WishItem.Update();\">");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Update Selected</span></button></label>");
            wishLstButtonBdl.Append(
                "<label class='i-clear cssClassGreyBtn'><button type=\"button\" id=\"clearWishList\" onclick=\"WishItem.Clear();\">");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Clear WishList</span></button></label>");
            wishLstButtonBdl.Append("<label class='i-delete cssClassGreenBtn'><button type=\"button\" id=\"btnDeletedMultiple\">");
            wishLstButtonBdl.Append("");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Delete Selected</span></button></label>");
            wishLstButtonBdl.Append("<label class='i-arrow-right cssClassDarkBtn'><button type=\"button\" id=\"continueInStore\">");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Continue Shopping</span></button ></label>");

            StringBuilder wishListPaginationBdl = new StringBuilder();
            wishListPaginationBdl.Append("<span class=\"sfLocale\">View Per Page: </span><select id=\"ddlWishListPageSize\" class=\"sfListmenu\"><option value=\"\"></option></select>");

            ltrWishListButon.Text      = wishLstButtonBdl.ToString();
            ltrWishListPagination.Text = wishListPaginationBdl.ToString();
        }
        else
        {
            wishListStringBld.Append("<tr><td class=\"cssClassNotFound\">" + getLocale("Your wishlist is empty!") + "</td></tr>");
        }
        ltrWishList.Text = wishListStringBld.ToString();
    }
コード例 #6
0
    private void BindWishList(AspxCommonInfo aspxCommonObj)
    {
        string modulePath    = this.AppRelativeTemplateSourceDirectory;
        string pageExtension = SageFrameSettingKeys.PageExtension;

        hst = AppLocalized.getLocale(modulePath);
        string aspxTemplateFolderPath = resolveUrl + "Templates/" + TemplateName;
        string aspxRootPath           = resolveUrl;
        string cssClass;

        DataSet ds = WishItemController.GetWishItemListDataSet(aspxCommonObj);

        #region WishList Setting
        if (ds != null && ds.Tables != null && ds.Tables.Count > 0)
        {
            DataTable dtWishListSetting = ds.Tables[0];
            if (dtWishListSetting.Rows.Count > 0)
            {
                ShowImageInWishlist = bool.Parse(dtWishListSetting.Rows[0]["IsEnableImageInWishlist"].ToString());
            }
        }
        #endregion

        #region WishList Content Html
        StringBuilder wishListItems = new StringBuilder();

        DataTable dtWishItems = ds.Tables[1];
        RowTotal    = dtWishItems.Rows.Count;
        ArrayLength = (int)dtWishItems.Rows[0]["RowTotal"];

        #region Variables
        string imagePath = string.Empty, imagePathColumn = string.Empty, alternateText = string.Empty;
        string WishDate = string.Empty, cartUrl = string.Empty, href = string.Empty;

        int i = 0;

        StringBuilder dataContent = new StringBuilder();
        StringBuilder currencyContent;
        #endregion
        if (dtWishItems != null && RowTotal > 0)
        {
            wishListItems.Append("<thead><tr class=\"cssClassCommonCenterBoxTableHeading\"><th class=\"cssClassWishItemChkbox\"> <input type=\"checkbox\" id=\"chkHeading\"/></th>");
            if (ShowImageInWishlist)
            {
                wishListItems.Append("<th class=\"cssClassWishItemImg\"> <label class=\"sfLocale\">Image</label></th>");
            }
            wishListItems.Append("<th class=\"cssClassWishItemDetails\"><label id=\"lblItem\" class=\"sfLocale\">Item Details and Comment</label></th><th class=\"row-variants\"><label id=\"lblVariant\" class=\"sfLocale\">Variants</label></th>");
            if (bool.Parse(AllowAddToCart))
            {
                wishListItems.Append("<th class=\"cssClassAddToCart\"><span id=\"lblAddToCart\" class=\"sfLocale\">Add To Cart</span></th>");
            }
            wishListItems.Append("<th class=\"cssClassDelete\"><span class=\"\">Action</span></th></tr></thead><tbody>");

            foreach (DataRow dr in dtWishItems.Rows)
            {
                imagePath = string.Empty; imagePathColumn = string.Empty; alternateText = string.Empty;
                WishDate  = string.Empty; cartUrl = string.Empty; href = string.Empty;
                href      = "";
                cartUrl   = "";

                i++;

                imagePathColumn = dr["ImagePath"].ToString();
                alternateText   = dr["AlternateText"].ToString();
                imagePath       = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + imagePathColumn;
                if (string.IsNullOrEmpty(imagePathColumn))
                {
                    imagePath = NoImageWishList;
                }
                else if (string.IsNullOrEmpty(alternateText))
                {
                    alternateText = dr["ItemName"].ToString();
                    InterceptImageController.ImageBuilder(imagePathColumn, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
                }
                else
                {
                    InterceptImageController.ImageBuilder(imagePathColumn, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
                }
                WishDate = Convert.ToDateTime(dr["WishDate"]).ToShortDateString();
                var itemSKU     = new JavaScriptSerializer().Serialize(dr["SKU"]);
                var costVariant = new JavaScriptSerializer().Serialize(dr["CostVariantValueIDs"]);
                if (string.IsNullOrEmpty(dr["CostVariantValueIDs"].ToString()))
                {
                    cartUrl = "#";
                    href    = aspxRedirectPath + "item/" + dr["SKU"].ToString() + pageExtension;
                }
                else
                {
                    cartUrl = aspxRedirectPath + "item/" + dr["SKU"].ToString() + pageExtension + "?varId=" + dr["CostVariantValueIDs"];
                    href    = aspxRedirectPath + "item/" + dr["SKU"] + pageExtension + "?varId=" + dr["CostVariantValueIDs"];
                }

                #region DataContent StringBuilder
                dataContent = new StringBuilder();
                dataContent.Append("data-class=\"addtoCart\" data-type=\"button\" data-addtocart=\"");
                dataContent.Append("addtocart");
                dataContent.Append(dr["ItemID"]);
                dataContent.Append("\" data-title=\"");
                dataContent.Append(dr["ItemName"]);
                dataContent.Append("\" data-onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                dataContent.Append(dr["ItemID"]);
                dataContent.Append(",");
                dataContent.Append(dr["Price"]);
                dataContent.Append(",'");
                dataContent.Append(dr["SKU"]);
                dataContent.Append("',");
                dataContent.Append(1);
                dataContent.Append(",'");
                dataContent.Append(dr["IsCostVariantItem"]);
                dataContent.Append("',this);\"");
                #endregion

                if (i % 2 == 0)
                {
                    cssClass = "sfEven";
                    wishListItems.Append("<tr class=\"sfEven\" id=\"tr_");
                }
                else
                {
                    cssClass = "sfOdd";
                    wishListItems.Append("<tr class=\"sfOdd\" id=\"tr_");
                }
                #region Table Row
                wishListItems.Append("<tr class=\"");
                wishListItems.Append(cssClass);
                wishListItems.Append("\" id=\"tr_");
                wishListItems.Append(dr["ItemID"]);
                wishListItems.Append("\"><td class=\"cssClassWishItemChkbox\"><input type=\"checkbox\" id=\"");
                wishListItems.Append(dr["WishItemID"]);
                wishListItems.Append("\" class=\"cssClassWishItem\"/></td>");
                if (ShowImageInWishlist)
                {
                    wishListItems.Append("<td class=\"cssClassWishItemImg\">");
                    wishListItems.Append("<div class=\"cssClassImage\">");
                    wishListItems.Append("<img src=\"");
                    wishListItems.Append(aspxRootPath);
                    wishListItems.Append(imagePath.Replace("uploads", "uploads/Small"));
                    wishListItems.Append("\" alt=\"");
                    wishListItems.Append(alternateText);
                    wishListItems.Append("\" title=\"");
                    wishListItems.Append(alternateText);
                    wishListItems.Append("\"/>");
                    wishListItems.Append("</div></td>");
                }
                wishListItems.Append("<td class=\"cssClassWishItemDetails\"><a href=\"");
                wishListItems.Append(href);
                wishListItems.Append("\">");
                wishListItems.Append(dr["ItemName"]);
                wishListItems.Append("</a>");
                wishListItems.Append("<div class=\"cssClassWishDate\"><i class='i-calender'></i>");
                wishListItems.Append(WishDate);
                wishListItems.Append("</div>");
                wishListItems.Append("<div class=\"cssClassWishComment\"><textarea maxlength=\"600\" onkeyup=\"WishItem.ismaxlength(this);\"");
                wishListItems.Append(" id=\"comment_");
                wishListItems.Append(dr["WishItemID"]);
                wishListItems.Append("\" class=\"comment\">");
                wishListItems.Append(dr["Comment"]);
                wishListItems.Append("</textarea></div></td>");
                wishListItems.Append("<td><input type=\"hidden\" name=\"hdnCostVariandValueIDS\" value=");
                wishListItems.Append(costVariant);
                wishListItems.Append("/>");
                wishListItems.Append("<span>");
                wishListItems.Append(dr["ItemCostVariantValue"]);
                wishListItems.Append("</span></td>");
                if (bool.Parse(AllowAddToCart))
                {
                    wishListItems.Append("<td class=\"cssClassWishToCart\">");
                    currencyContent = new StringBuilder();
                    currencyContent.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">");
                    currencyContent.Append(decimal.Parse(dr["Price"].ToString()).ToString("N2"));
                    currencyContent.Append("</span>");
                    if ((int)dr["ItemTypeID"] == 5)
                    {
                        wishListItems.Append("<p class=\"cssClassGroupPriceWrapper\">");
                        wishListItems.Append(getLocale("Starting At "));
                        wishListItems.Append(currencyContent);
                        wishListItems.Append("</p>");
                    }
                    else
                    {
                        wishListItems.Append(currencyContent);
                    }
                    wishListItems.Append("<div data-ItemTypeID=\"");
                    wishListItems.Append(dr["ItemTypeID"]);
                    wishListItems.Append("\" data-ItemID=\"");
                    wishListItems.Append(dr["ItemID"]);
                    wishListItems.Append("\"");
                    wishListItems.Append(dataContent);
                    wishListItems.Append(" class=\"sfButtonwrapper");
                    #region Allow Add To Cart
                    if (!bool.Parse(AllowOutStockPurchase))
                    {
                        #region Allow Out Stock Purchase True
                        if (dr["IsOutOfStock"] != null && (bool)dr["IsOutOfStock"])
                        {
                            #region Is Out Of Stock True
                            wishListItems.Append(" cssClassOutOfStock\">");
                            wishListItems.Append("<span class=\"cssClassOutStock\">");
                            wishListItems.Append(getLocale("Out Of Stock"));
                            wishListItems.Append("</span>");
                            #endregion
                        }
                        else
                        {
                            #region Is Out Of Stock False
                            wishListItems.Append("\">");
                            wishListItems.Append("<label class=\"i-cart cssClassCartLabel cssClassGreenBtn\"><button type=\"button\" class=\"addtoCart\"");
                            wishListItems.Append("addtocart=\"");
                            wishListItems.Append("addtocart");
                            wishListItems.Append(dr["ItemID"]);
                            wishListItems.Append("\" title=\"");
                            wishListItems.Append(dr["ItemName"]);
                            wishListItems.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                            wishListItems.Append(dr["ItemID"]);
                            wishListItems.Append(",");
                            wishListItems.Append(dr["Price"]);
                            wishListItems.Append(",");
                            wishListItems.Append("'");
                            wishListItems.Append(dr["SKU"]);
                            wishListItems.Append("'");
                            wishListItems.Append(",");
                            wishListItems.Append(1);
                            wishListItems.Append(",'");
                            wishListItems.Append(dr["IsCostVariantItem"]);
                            wishListItems.Append("',this);\"><span>");
                            wishListItems.Append(getLocale("Cart +"));
                            wishListItems.Append("</span></button></label>");
                            #endregion
                        }
                        #endregion
                    }
                    else
                    {
                        #region Allow Out Stock Purchase False
                        wishListItems.Append("\">");
                        wishListItems.Append("<label class=\"i-cart cssClassCartLabel cssClassGreenBtn\"><button type=\"button\" class=\"addtoCart\"");
                        wishListItems.Append("addtocart=\"");
                        wishListItems.Append("addtocart");
                        wishListItems.Append(dr["ItemID"]);
                        wishListItems.Append("\" title=\"");
                        wishListItems.Append(dr["ItemName"]);
                        wishListItems.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                        wishListItems.Append(dr["ItemID"]);
                        wishListItems.Append(",");
                        wishListItems.Append(dr["Price"]);
                        wishListItems.Append(",");
                        wishListItems.Append("'");
                        wishListItems.Append(dr["SKU"]);
                        wishListItems.Append("'");
                        wishListItems.Append(",");
                        wishListItems.Append(1);
                        wishListItems.Append(",'");
                        wishListItems.Append(dr["IsCostVariantItem"]);
                        wishListItems.Append("',this);\"><span>");
                        wishListItems.Append(getLocale("Cart +"));
                        wishListItems.Append("</span></button></label>");
                        #endregion
                    }
                    wishListItems.Append("</div></td>");
                    #endregion
                }
                wishListItems.Append("<td class=\"cssClassDelete\">");
                wishListItems.Append("<a onclick=\"WishItem.Delete(");
                wishListItems.Append(dr["WishItemID"]);
                wishListItems.Append(")\" title=\"");
                wishListItems.Append(getLocale("Delete"));
                wishListItems.Append("\"><i class='i-delete' original-title=\"");
                wishListItems.Append(getLocale("Delete"));
                wishListItems.Append("\"></i></a>");
                wishListItems.Append("</td></tr>");
                #endregion
            }
            wishListItems.Append("</tbody>");
            /// wishListItems.Append("<script type=\"text/javascript\">$(document).ready(function(){$('.cssClassImage img[title]').tipsy({ gravity: 'n' });});</script>");

            StringBuilder wishLstButtonBdl = new StringBuilder();
            wishLstButtonBdl.Append("<label class='i-wishlist cssClassGreenBtn'><button type=\"button\" id=\"shareWishList\">");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Share Wishlist</span></button></label>");
            wishLstButtonBdl.Append(
                "<label class='i-update cssClassDarkBtn'><button type=\"button\" id=\"updateWishList\" onclick=\"WishItem.Update();\">");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Update Selected</span></button></label>");
            wishLstButtonBdl.Append(
                "<label class='i-clear cssClassGreyBtn'><button type=\"button\" id=\"clearWishList\" onclick=\"WishItem.Clear();\">");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Clear WishList</span></button></label>");
            wishLstButtonBdl.Append("<label class='i-delete cssClassGreenBtn'><button type=\"button\" id=\"btnDeletedMultiple\">");
            wishLstButtonBdl.Append("");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Delete Selected</span></button></label>");
            wishLstButtonBdl.Append("<label class='i-arrow-right cssClassDarkBtn'><button type=\"button\" id=\"continueInStore\">");
            wishLstButtonBdl.Append("<span class=\"sfLocale\">Continue Shopping</span></button ></label>");

            StringBuilder wishListPaginationBdl = new StringBuilder();
            wishListPaginationBdl.Append("<span class=\"sfLocale\">View Per Page: </span><select id=\"ddlWishListPageSize\" class=\"sfListmenu\"><option value=\"\"></option></select>");

            ltrWishListButon.Text      = wishLstButtonBdl.ToString();
            ltrWishListPagination.Text = wishListPaginationBdl.ToString();

            SortByList();
        }
        else
        {
            wishListItems.Append("<tr><td class=\"cssClassNotFound\">");
            wishListItems.Append(getLocale("Your wishlist is empty!"));
            wishListItems.Append("</td></tr>");
        }
        ltrWishList.Text = wishListItems.ToString();
        #endregion
    }
コード例 #7
0
    public void BindMyWishList()
    {
        string         flagShowAll   = "0";
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = StoreID;
        aspxCommonObj.PortalID    = PortalID;
        aspxCommonObj.UserName    = UserName;
        aspxCommonObj.CultureName = CultureName;
        string modulePath             = this.AppRelativeTemplateSourceDirectory;
        string aspxTemplateFolderPath = ResolveUrl("~/") + "Templates/" + TemplateName;
        string aspxRootPath           = ResolveUrl("~/");

        hst = AppLocalized.getLocale(modulePath);
        string               pageExtension = SageFrameSettingKeys.PageExtension;
        WishItemController   ctrl          = new WishItemController();
        List <WishItemsInfo> lstWishItem   = ctrl.GetRecentWishItemList(aspxCommonObj, flagShowAll,
                                                                        NoOfRecentAddedWishItems);
        StringBuilder recentWishList = new StringBuilder();

        recentWishList.Append("<div class=\"cssClassCommonSideBoxTable wishItem\">");
        if (lstWishItem != null && lstWishItem.Count > 0)
        {
            recentWishList.Append("<table class=\"cssClassMyWishItemTable\" id=\"tblWishItem\" width=\"100%\">");
            string myWishListLink = "";
            if (userFriendlyURL)
            {
                myWishListLink = WishListURL + pageExtension;
            }
            else
            {
                myWishListLink = WishListURL;
            }
            recentWishList.Append("<tbody>");
            for (int i = 0; i < lstWishItem.Count; i++)
            {
                string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + lstWishItem[i].ImagePath;
                if (string.IsNullOrEmpty(lstWishItem[i].ImagePath))
                {
                    imagePath = NoImageWishItemPath;
                }
                else
                {
                    //Resize Image Dynamically
                    InterceptImageController.ImageBuilder(lstWishItem[i].ImagePath, ImageType.Small, ImageCategoryType.Item, aspxCommonObj);
                }
                if (lstWishItem[i].AlternateText == "")
                {
                    lstWishItem[i].AlternateText = lstWishItem[i].ItemName;
                }
                var href = "";
                if (lstWishItem[i].CostVariantValueIDs == "")
                {
                    href = aspxRedirectPath + "item/" + lstWishItem[i].SKU + pageExtension;
                }
                else
                {
                    href = aspxRedirectPath + "item/" + lstWishItem[i].SKU + pageExtension + "?varId=" +
                           lstWishItem[i].CostVariantValueIDs;
                }
                StringBuilder dataContent = new StringBuilder();
                dataContent.Append("data-class=\"addtoCart\" data-type=\"button\" data-addtocart=\"");
                dataContent.Append("addtocart");
                dataContent.Append(lstWishItem[i].ItemID);
                dataContent.Append("\" data-title=\"");
                dataContent.Append(lstWishItem[i].ItemName);
                dataContent.Append("\" data-onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                dataContent.Append(lstWishItem[i].ItemID);
                dataContent.Append(",");
                dataContent.Append(lstWishItem[i].Price);
                dataContent.Append(",'");
                dataContent.Append(lstWishItem[i].SKU);
                dataContent.Append("',");
                dataContent.Append(1);
                dataContent.Append(",'");
                dataContent.Append(lstWishItem[i].IsCostVariantItem);
                dataContent.Append("',this);\"");
                if (i % 2 == 0)
                {
                    recentWishList.Append("<tr class=\"sfEven\" id=\"trWishItem_" + lstWishItem[i].ItemID +
                                          "\"><td class=\"cssClassWishItemDetails\">");
                    if (ShowWishedItemImage.ToLower() == "true")
                    {
                        recentWishList.Append("<a href =\"" + href + "\">");
                        recentWishList.Append("<div class=\"cssClassImage\"><img src=\"" + aspxRootPath +
                                              imagePath.Replace("uploads", "uploads/Small") + "\" alt=\"" +
                                              lstWishItem[i].AlternateText + "\"  title=\"" +
                                              lstWishItem[i].AlternateText +
                                              "\"/></div></a>");
                    }
                    if (lstWishItem[i].ItemCostVariantValue != "")
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "(" +
                                              lstWishItem[i].ItemCostVariantValue + ")" + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              decimal.Parse(lstWishItem[i].Price).ToString("N2") + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"wishItemsFront.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                    else
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              decimal.Parse(lstWishItem[i].Price).ToString("N2") + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"wishItemsFront.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                }
                else
                {
                    recentWishList.Append("<tr class=\"sfOdd\" id=\"trWishItem_" + lstWishItem[i].ItemID +
                                          "\"><td class=\"cssClassWishItemDetails\">");
                    if (ShowWishedItemImage.ToLower() == "true")
                    {
                        recentWishList.Append("<a href =\"" + href + "\">");
                        recentWishList.Append("<div class=\"cssClassImage\"><img src=\"" + aspxRootPath +
                                              imagePath.Replace("uploads", "uploads/Small") + "\" alt=\"" +
                                              lstWishItem[i].AlternateText + "\"  title=\"" +
                                              lstWishItem[i].AlternateText + "\"/></div></a>");
                    }
                    if (lstWishItem[i].ItemCostVariantValue != "")
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "(" +
                                              lstWishItem[i].ItemCostVariantValue + ")" + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              decimal.Parse(lstWishItem[i].Price).ToString("N2") + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"wishItemsFront.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                    else
                    {
                        recentWishList.Append("<a href=\"" + href + "\">" + lstWishItem[i].ItemName + "</a>");
                        recentWishList.Append("</br><span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                              decimal.Parse(lstWishItem[i].Price).ToString("N2") + "</span></td>");
                        recentWishList.Append("<td class=\"cssClassDelete\">");
                        recentWishList.Append(
                            "<img onclick=\"wishItemsFront.DeleteWishListItem(" + lstWishItem[i].WishItemID + ")\" src=\"" +
                            aspxTemplateFolderPath + "/images/admin/btndelete.png\"/>");
                        recentWishList.Append("</td></tr>");
                    }
                }
            }
            recentWishList.Append("</tbody>");
            recentWishList.Append("</table>");
            recentWishList.Append("<div class=\"cssClassWishLink\">");
            recentWishList.Append("<a href=\"" + aspxRedirectPath + myWishListLink + "\" id=\"lnkGoToWishlist\">");
            recentWishList.Append("<span class=\"gowishlist\">" + getLocale("Go to Wishlist") + "</span></a>");
            recentWishList.Append("</div></div>");
        }
        else
        {
            recentWishList.Append("<tbody>");
            recentWishList.Append("<tr><td><span class=\"cssClassNotFound\">" + getLocale("Your Wishlist is empty!") +
                                  "</span></td></tr>");
            recentWishList.Append("</tbody>");
            recentWishList.Append("</table></div>");
        }

        ltrWishItem.Text = recentWishList.ToString();
    }