예제 #1
0
    public void GetItemRelatedUpSellAndCrossSellList(string itemsku)
    {
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

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

        hst = AppLocalized.getLocale(modulePath);
        string pageExtension = SageFrameSettingKeys.PageExtension;
        AspxYouMayAlsoLikeController objYouMayLike  = new AspxYouMayAlsoLikeController();
        List <YouMayAlsoLikeInfo>    lstRelatedItem = objYouMayLike.GetYouMayAlsoLikeItems(itemsku, aspxCommonObj, NoOfYouMayAlsoLikeItems);
        StringBuilder realatedItemCartContent       = new StringBuilder();

        if (lstRelatedItem != null && lstRelatedItem.Count > 0)
        {
            realatedItemCartContent.Append("<h2 class=\"sfLocale\">You May Also Like</h2>");
            foreach (YouMayAlsoLikeInfo item in lstRelatedItem)
            {
                string imagePath    = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.BaseImage;
                string altImagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.Name;
                if (item.BaseImage == "")
                {
                    imagePath = NoImageYouMayAlsoLikePath;
                }
                else
                {
                    //Resize Image Dynamically
                    InterceptImageController.ImageBuilder(item.BaseImage, ImageType.Medium, ImageCategoryType.Item, aspxCommonObj);
                }
                if (item.AlternateText == "")
                {
                    item.AlternateText = item.Name;
                }
                string        itemPrice      = Math.Round(double.Parse((item.Price).ToString()), 2).ToString();
                string        itemPriceValue = Math.Round(double.Parse((item.Price).ToString()), 2).ToString();
                string        itemPriceRate  = Math.Round(double.Parse((item.Price).ToString()), 2).ToString("N2");
                StringBuilder dataContent    = new StringBuilder();
                dataContent.Append("data-class=\"addtoCart\" data-ItemTypeID=\"" + item.ItemTypeID + "\" data-ItemID=\"" + item.ItemID + "\"data-type=\"button\" data-addtocart=\"");
                dataContent.Append("addtocart");
                dataContent.Append(item.ItemID);
                dataContent.Append("\" data-title=\"");
                dataContent.Append(item.Name);
                dataContent.Append("\" data-onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                dataContent.Append(item.ItemID);
                dataContent.Append(",");
                dataContent.Append(itemPriceValue);
                dataContent.Append(",'");
                dataContent.Append(item.SKU);
                dataContent.Append("',");
                dataContent.Append(1);
                dataContent.Append(",'");
                dataContent.Append(item.IsCostVariantItem);
                dataContent.Append("',this);\"");
                if ((lstRelatedItem.IndexOf(item) + 1) % NoOfYouMayAlsoLikeInARow == 0)
                {
                    realatedItemCartContent.Append("<div class=\"cssClassProductsBox cssClassNoMargin\">");
                }
                else
                {
                    realatedItemCartContent.Append("<div class=\"cssClassProductsBox\">");
                }
                var hrefItem = aspxRedirectPath + "item/" + fixedEncodeURIComponent(item.SKU) + pageExtension;
                realatedItemCartContent.Append("<div id=\"productImageWrapID_");
                realatedItemCartContent.Append(item.ItemID);
                realatedItemCartContent.Append("\" class=\"cssClassProductsBoxInfo\" costvariantItem=");
                realatedItemCartContent.Append(item.IsCostVariantItem);
                realatedItemCartContent.Append("  itemid=\"");
                realatedItemCartContent.Append(item.ItemID);
                realatedItemCartContent.Append("\">");
                realatedItemCartContent.Append("<h3>");
                realatedItemCartContent.Append(item.SKU);
                realatedItemCartContent.Append("</h3><div class=\"divQuickLookonHover\"><div class=\"divitemImage cssClassProductPicture\"><a href=\"");
                realatedItemCartContent.Append(hrefItem);
                realatedItemCartContent.Append("\" ><img id=\"img_");
                realatedItemCartContent.Append(item.ItemID);
                realatedItemCartContent.Append("\"  alt=\"");
                realatedItemCartContent.Append(item.AlternateText);
                realatedItemCartContent.Append("\"  title=\"");
                realatedItemCartContent.Append(item.AlternateText);
                realatedItemCartContent.Append("\"");
                realatedItemCartContent.Append("src=\"");
                realatedItemCartContent.Append(aspxRootPath);
                realatedItemCartContent.Append(imagePath.Replace("uploads", "uploads/Medium"));
                realatedItemCartContent.Append("\" orignalPath=\"");
                realatedItemCartContent.Append(imagePath.Replace("uploads", "uploads/Medium"));
                realatedItemCartContent.Append("\" altImagePath=\"");
                realatedItemCartContent.Append(altImagePath.Replace("uploads", "uploads/Medium"));
                realatedItemCartContent.Append("\"/></a></div>");
                realatedItemCartContent.Append("<div class='cssLatestItemInfo'>");
                realatedItemCartContent.Append("<h2><a href=\"");
                realatedItemCartContent.Append(hrefItem);
                realatedItemCartContent.Append("\" title=\"" + item.Name + "\">");
                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;
                }
                realatedItemCartContent.Append(name);
                realatedItemCartContent.Append("</a></h2>");
                if (item.HidePrice != true)
                {
                    if (item.ListPrice != null && item.ListPrice != "")
                    {
                        if (item.ItemTypeID == 5)
                        {
                            realatedItemCartContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                            realatedItemCartContent.Append("<p class=\"cssClassProductRealPrice \">");
                            realatedItemCartContent.Append(getLocale("Starting At "));
                            realatedItemCartContent.Append("<span class=\"cssClassFormatCurrency\">");
                            realatedItemCartContent.Append(itemPriceRate);
                            realatedItemCartContent.Append("</span></p></div></div>");
                        }
                        else
                        {
                            string strAmount = Math.Round(Convert.ToDecimal(item.ListPrice), 2).ToString("N2");
                            realatedItemCartContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                            realatedItemCartContent.Append("<p class=\"cssClassProductOffPrice\">");
                            realatedItemCartContent.Append("<span class=\"cssClassFormatCurrency\">");
                            realatedItemCartContent.Append(strAmount);
                            realatedItemCartContent.Append("</span></p><p class=\"cssClassProductRealPrice \">");
                            realatedItemCartContent.Append("<span class=\"cssClassFormatCurrency\">");
                            realatedItemCartContent.Append(itemPriceRate);
                            realatedItemCartContent.Append("</span></p></div></div>");
                        }
                    }
                    else
                    {//Added for group type products
                        if (item.ItemTypeID == 5)
                        {
                            realatedItemCartContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                            realatedItemCartContent.Append("<p class=\"cssClassProductRealPrice \">");
                            realatedItemCartContent.Append(getLocale("Starting At "));
                            realatedItemCartContent.Append("<span class=\"cssClassFormatCurrency\">");
                            realatedItemCartContent.Append(itemPriceRate);
                            realatedItemCartContent.Append("</span></p></div></div>");
                        }
                        else
                        {
                            realatedItemCartContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                            realatedItemCartContent.Append("<p class=\"cssClassProductRealPrice \">");
                            realatedItemCartContent.Append("<span class=\"cssClassFormatCurrency\">");
                            realatedItemCartContent.Append(itemPriceRate);
                            realatedItemCartContent.Append("</span></p></div></div>");
                        }
                    }
                }
                else
                {
                    realatedItemCartContent.Append("<div class=\"cssClassProductPriceBox\"></div>");
                }
                realatedItemCartContent.Append("<div class=\"cssClassProductDetail\"><p><a href=\"");
                realatedItemCartContent.Append(aspxRedirectPath);
                realatedItemCartContent.Append("item/");
                realatedItemCartContent.Append(item.SKU);
                realatedItemCartContent.Append(pageExtension);
                realatedItemCartContent.Append("\">");
                realatedItemCartContent.Append(getLocale("Details"));
                realatedItemCartContent.Append("</a></p></div>");

                realatedItemCartContent.Append("<div class=\"sfQuickLook\" style=\"display:none\">");
                realatedItemCartContent.Append("<img itemId=\"");
                realatedItemCartContent.Append(item.ItemID);
                realatedItemCartContent.Append("\" sku=\"");
                realatedItemCartContent.Append(item.SKU);
                realatedItemCartContent.Append("\" src=\"");
                realatedItemCartContent.Append(aspxTemplateFolderPath);
                realatedItemCartContent.Append("/images/QV_Button.png\" alt=\"\" rel=\"popuprel\" />");
                realatedItemCartContent.Append("</div>");
                string itemSKU  = item.SKU;
                string itemName = item.Name;
                if (AllowAddToCart.ToLower() == "true")
                {
                    if (AllowOutStockPurchase.ToLower() == "false")
                    {
                        if (item.IsOutOfStock == true)
                        {
                            realatedItemCartContent.Append("<div class=\"cssClassAddtoCard\"><div " + dataContent + " class=\"sfButtonwrapper cssClassOutOfStock\">");
                            realatedItemCartContent.Append("<button type=\"button\"><span>");
                            realatedItemCartContent.Append(getLocale("Out Of Stock"));
                            realatedItemCartContent.Append("</span></button></div></div>");
                        }
                        else
                        {
                            realatedItemCartContent.Append("<div class=\"cssClassAddtoCard\"><div " + dataContent + "class=\"sfButtonwrapper\">");
                            realatedItemCartContent.Append("<label class='i-cart cssClassCartLabel cssClassGreenBtn'><button type=\"button\" class=\"addtoCart\"");
                            realatedItemCartContent.Append("data-addtocart=\"");
                            realatedItemCartContent.Append("addtocart");
                            realatedItemCartContent.Append(item.ItemID);
                            realatedItemCartContent.Append("\" title=\"");
                            realatedItemCartContent.Append(itemName);
                            realatedItemCartContent.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                            realatedItemCartContent.Append(item.ItemID);
                            realatedItemCartContent.Append(",");
                            realatedItemCartContent.Append(itemPriceValue);
                            realatedItemCartContent.Append(",'");
                            realatedItemCartContent.Append(itemSKU);
                            realatedItemCartContent.Append("',");
                            realatedItemCartContent.Append(1);
                            realatedItemCartContent.Append(",'");
                            realatedItemCartContent.Append(item.IsCostVariantItem);
                            realatedItemCartContent.Append("',this);\">");
                            realatedItemCartContent.Append(getLocale("Cart +"));
                            realatedItemCartContent.Append("</button></label></div></div>");
                        }
                    }
                    else
                    {
                        realatedItemCartContent.Append("<div class=\"cssClassAddtoCard\"><div " + dataContent + " class=\"sfButtonwrapper\">");
                        realatedItemCartContent.Append("<label class='i-cart cssClassCartLabel cssClassGreenBtn'><button type=\"button\" class=\"addtoCart\"");
                        realatedItemCartContent.Append("data-addtocart=\"");
                        realatedItemCartContent.Append("addtocart");
                        realatedItemCartContent.Append(item.ItemID);
                        realatedItemCartContent.Append("\" title=\"");
                        realatedItemCartContent.Append(itemName);
                        realatedItemCartContent.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                        realatedItemCartContent.Append(item.ItemID);
                        realatedItemCartContent.Append(",");
                        realatedItemCartContent.Append(itemPriceValue);
                        realatedItemCartContent.Append(",'");
                        realatedItemCartContent.Append(itemSKU);
                        realatedItemCartContent.Append("',");
                        realatedItemCartContent.Append(1);
                        realatedItemCartContent.Append(",'");
                        realatedItemCartContent.Append(item.IsCostVariantItem);
                        realatedItemCartContent.Append("',this);\">");
                        realatedItemCartContent.Append(getLocale("Cart +"));
                        realatedItemCartContent.Append("</button></label></div></div>");
                    }
                    realatedItemCartContent.Append("</div></div>");
                }
                realatedItemCartContent.Append("</div>");
                realatedItemCartContent.Append("</div>");
            }
        }
        ltrRelatedItemInCart.Text = realatedItemCartContent.ToString();
    }
예제 #2
0
    private void BindSpecialItems(AspxCommonInfo aspxCommonObj)
    {
        string modulePath             = this.AppRelativeTemplateSourceDirectory;
        string aspxRootPath           = ResolveUrl("~/");
        string aspxTemplateFolderPath = aspxRootPath + "Templates/" + TemplateName;

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

        DataSet dsSpecialItems = SpecialItemsController.GetSpecialItemsandSettingDataSet(aspxCommonObj);

        if (dsSpecialItems != null && dsSpecialItems.Tables.Count == 2)
        {
            #region Special Items Setting
            DataTable dtSpecialItemsSetting = dsSpecialItems.Tables[0];
            if (dtSpecialItemsSetting != null & dtSpecialItemsSetting.Rows.Count > 0)
            {
                NoOfItemInRow     = Convert.ToInt32(dtSpecialItemsSetting.Rows[0]["NoOfItemInRow"].ToString());
                SpecialItemRss    = dtSpecialItemsSetting.Rows[0]["IsEnableSpecialItemsRss"].ToString();
                SpecialDetailPage = dtSpecialItemsSetting.Rows[0]["SpecialItemsDetailPageName"].ToString();
                RssFeedUrl        = dtSpecialItemsSetting.Rows[0]["SpecialItemsRssPageName"].ToString();
            }
            #endregion

            #region Special Items Html Helper
            DataTable     dtSpecialItems    = dsSpecialItems.Tables[1];
            int           nosOfSpecialItems = dtSpecialItems.Rows.Count;
            StringBuilder specialContent    = new StringBuilder();

            if (dtSpecialItems != null && nosOfSpecialItems > 0)
            {
                specialContent.Append("<div class=\"cssClassSpecialBoxInfo\" id=\"divSpItem\">");
                int i = 0;
                foreach (DataRow drSpecialItem in dtSpecialItems.Rows)
                {
                    i++;
                    string imagePath    = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + drSpecialItem["ImagePath"];
                    string altImagePath = "";
                    if (string.IsNullOrEmpty(drSpecialItem["ImagePath"].ToString()))
                    {
                        imagePath = DefaultImagePath;
                    }
                    else
                    {
                        //Resize Image Dynamically
                        InterceptImageController.ImageBuilder(drSpecialItem["ImagePath"].ToString(), ImageType.Medium, ImageCategoryType.Item, aspxCommonObj);
                    }
                    if (string.IsNullOrEmpty(drSpecialItem["ImagePath"].ToString()))
                    {
                        altImagePath = imagePath;
                    }
                    string itemPrice      = Convert.ToDecimal(drSpecialItem["Price"].ToString()).ToString("N2");
                    string itemPriceValue = drSpecialItem["Price"].ToString();
                    string itemPriceRate  = Convert.ToDecimal(drSpecialItem["Price"].ToString()).ToString("N2");

                    if (i % NoOfItemInRow == 0)
                    {
                        specialContent.Append("<div class=\"cssClassProductsBox cssClassNoMargin\">");
                    }
                    else
                    {
                        specialContent.Append("<div class=\"cssClassProductsBox\">");
                    }
                    var hrefItem = aspxRedirectPath + "item/" + fixedEncodeURIComponent(drSpecialItem["SKU"].ToString()) + pageExtension;
                    specialContent.Append("<div id=\"productImageWrapID_");
                    specialContent.Append(drSpecialItem["ItemID"]);
                    specialContent.Append("\" class=\"cssClassProductsBoxInfo\" costvariantItem=");
                    specialContent.Append(drSpecialItem["CostVariants"]);
                    specialContent.Append("  itemid=\"");
                    specialContent.Append(drSpecialItem["ItemID"]);
                    specialContent.Append("\">");
                    specialContent.Append("<h3>");
                    specialContent.Append(drSpecialItem["SKU"]);
                    specialContent.Append("</h3><div class=\"divQuickLookonHover\"><div class=\"divitemImage cssClassProductPicture\"><a href=\"");
                    specialContent.Append(hrefItem);
                    specialContent.Append("\" ><img id=\"img_");
                    specialContent.Append(drSpecialItem["ItemID"]);
                    specialContent.Append("\"  alt=\"");
                    specialContent.Append(drSpecialItem["Name"]);
                    specialContent.Append("\"  title=\"");
                    specialContent.Append(drSpecialItem["Name"]);
                    specialContent.Append("\"");
                    specialContent.Append("src=\"");
                    specialContent.Append(aspxRootPath);
                    specialContent.Append(imagePath.Replace("uploads", "uploads/Medium"));
                    specialContent.Append("\" orignalPath=\"");
                    specialContent.Append(imagePath.Replace("uploads", "uploads/Medium"));
                    specialContent.Append("\" altImagePath=\"");
                    specialContent.Append(altImagePath.Replace("uploads", "uploads/Medium"));
                    specialContent.Append("\"/></a></div>");
                    specialContent.Append("<div class='cssLatestItemInfo clearfix'>");
                    specialContent.Append("<h2><a href=\"");
                    specialContent.Append(hrefItem);
                    specialContent.Append("\" title=\"");
                    specialContent.Append(drSpecialItem["Name"]);
                    specialContent.Append("\">");

                    string name = string.Empty;
                    if (drSpecialItem["Name"].ToString().Length > 50)
                    {
                        name = drSpecialItem["Name"].ToString().Substring(0, 50);
                        int index = 0;
                        index = name.LastIndexOf(' ');
                        name  = name.Substring(0, index);
                        name  = name + "...";
                    }
                    else
                    {
                        name = drSpecialItem["Name"].ToString();
                    }
                    specialContent.Append(name);
                    specialContent.Append("</a></h2>");
                    StringBuilder dataContent = new StringBuilder();
                    dataContent.Append("data-class=\"addtoCart\" data-ItemTypeID=\"");
                    dataContent.Append(drSpecialItem["ItemTypeID"]);
                    dataContent.Append("\" data-type=\"button\" data-ItemID=\"");
                    dataContent.Append(drSpecialItem["ItemID"]);
                    dataContent.Append("\" data-addtocart=\"");
                    dataContent.Append("addtocart");
                    dataContent.Append(drSpecialItem["ItemID"]);
                    dataContent.Append("\" data-title=\"");
                    dataContent.Append(name);
                    dataContent.Append("\" data-onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                    dataContent.Append(drSpecialItem["ItemID"]);
                    dataContent.Append(",");
                    dataContent.Append(itemPriceValue);
                    dataContent.Append(",'");
                    dataContent.Append(drSpecialItem["SKU"]);
                    dataContent.Append("',");
                    dataContent.Append(1);
                    dataContent.Append(",'");
                    dataContent.Append(drSpecialItem["CostVariants"]);
                    dataContent.Append("',this);\"");

                    specialContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");

                    if (!string.IsNullOrEmpty(drSpecialItem["ListPrice"].ToString()))
                    {//Added for group type products
                        if ((int)drSpecialItem["ItemTypeID"] == 5)
                        {
                            specialContent.Append("<p class=\"cssClassProductRealPrice \">");
                            specialContent.Append(getLocale("Starting At"));
                        }
                        else
                        {
                            string strAmount = Math.Round((decimal)(drSpecialItem["ListPrice"]), 2).ToString("N2");
                            specialContent.Append("<p class=\"cssClassProductOffPrice\">");
                            specialContent.Append("<span class=\"cssClassFormatCurrency\">");
                            specialContent.Append(strAmount);
                            specialContent.Append("</span></p><p class=\"cssClassProductRealPrice \">");
                        }
                    }
                    else
                    {
                        if ((int)drSpecialItem["ItemTypeID"] == 5)
                        {
                            specialContent.Append("<p class=\"cssClassProductRealPrice \" >");
                            specialContent.Append(getLocale("Starting At"));
                        }
                        else
                        {
                            specialContent.Append("<p class=\"cssClassProductRealPrice \" >");
                        }
                    }

                    specialContent.Append("<span class=\"cssClassFormatCurrency\">");
                    specialContent.Append(itemPriceRate);
                    specialContent.Append("</span></p></div></div>");

                    specialContent.Append("<div class=\"cssClassProductDetail\"><p><a href=\"");
                    specialContent.Append(aspxRedirectPath);
                    specialContent.Append("item/");
                    specialContent.Append(drSpecialItem["SKU"]);
                    specialContent.Append(pageExtension);
                    specialContent.Append("\">");
                    specialContent.Append(getLocale("Details"));
                    specialContent.Append("</a></p></div>");

                    specialContent.Append("<div class=\"sfQuickLook\" style=\"display:none\">");
                    specialContent.Append("<img itemId=\"");
                    specialContent.Append(drSpecialItem["ItemID"]);
                    specialContent.Append("\" sku=\"");
                    specialContent.Append(drSpecialItem["SKU"]);
                    specialContent.Append("\" src=\"");
                    specialContent.Append(aspxTemplateFolderPath);
                    specialContent.Append("/images/QV_Button.png\" alt=\"\" rel=\"popuprel\" />");
                    specialContent.Append("</div>");
                    if (!string.IsNullOrEmpty(drSpecialItem["AttributeValues"].ToString()))
                    {
                        specialContent.Append("<div class=\"cssGridDyanamicAttr\">");
                        if (!string.IsNullOrEmpty(drSpecialItem["AttributeValues"].ToString()))
                        {
                            string[] attributeValues = drSpecialItem["AttributeValues"].ToString().Split(',');
                            foreach (string element in attributeValues)
                            {
                                string[] attributes     = element.Split('#');
                                string   attributeName  = attributes[0];
                                string   attributeValue = attributes[1];
                                int      inputType      = Int32.Parse(attributes[2]);
                                string   validationType = attributes[3];
                                specialContent.Append("<div class=\"cssDynamicAttributes\">");
                                specialContent.Append("<div class=\"cssDynamicAttributes\">");
                                specialContent.Append("<span>");
                                specialContent.Append(attributeName);
                                specialContent.Append("</span> :");
                                if (inputType == 7)
                                {
                                    specialContent.Append("<span class=\"cssClassFormatCurrency\">");
                                }
                                else
                                {
                                    specialContent.Append("<span>");
                                }
                                specialContent.Append(attributeValue);
                                specialContent.Append("</span></div>");
                            }
                        }
                        specialContent.Append("</div>");
                    }
                    string itemSKU  = drSpecialItem["SKU"].ToString();
                    string itemName = drSpecialItem["Name"].ToString();

                    specialContent.Append("<div class=\"cssClassTMar20\">");
                    if (AllowAddToCart.ToLower() == "true")
                    {
                        if (AllowOutStockPurchase.ToLower() == "false")
                        {
                            if ((bool)drSpecialItem["IsOutOfStock"])
                            {
                                specialContent.Append("<div class=\"cssClassAddtoCard\"><div ");
                                specialContent.Append(dataContent);
                                specialContent.Append(" class=\"sfButtonwrapper cssClassOutOfStock\">");
                                specialContent.Append("<button type=\"button\"><span>");
                                specialContent.Append(getLocale("Out Of Stock"));
                                specialContent.Append("</span></button></div></div>");
                            }
                            else
                            {
                                specialContent.Append("<div class=\"cssClassAddtoCard\"><div ");
                                specialContent.Append(dataContent);
                                specialContent.Append(" class=\"sfButtonwrapper\">");
                                specialContent.Append("<label class='i-cart cssClassCartLabel cssClassGreenBtn'><button type=\"button\" class=\"addtoCart\"");
                                specialContent.Append("data-addtocart=\"");
                                specialContent.Append("addtocart");
                                specialContent.Append(drSpecialItem["ItemID"]);
                                specialContent.Append("\" title=\"");
                                specialContent.Append(itemName);
                                specialContent.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                                specialContent.Append(drSpecialItem["ItemID"]);
                                specialContent.Append(",");
                                specialContent.Append(itemPriceValue);
                                specialContent.Append(",'");
                                specialContent.Append(itemSKU);
                                specialContent.Append("',");
                                specialContent.Append(1);
                                specialContent.Append(",'");
                                specialContent.Append(drSpecialItem["CostVariants"]);
                                specialContent.Append("',this);\">");
                                specialContent.Append(getLocale("Cart +"));
                                specialContent.Append("</button></label></div></div>");
                            }
                        }
                        else
                        {
                            specialContent.Append("<div class=\"cssClassAddtoCard\"><div ");
                            specialContent.Append(dataContent);
                            specialContent.Append(" class=\"sfButtonwrapper\">");
                            specialContent.Append("<label class='i-cart cssClassCartLabel cssClassGreenBtn'><button type=\"button\" class=\"addtoCart\"");
                            specialContent.Append("data-addtocart=\"");
                            specialContent.Append("addtocart");
                            specialContent.Append(drSpecialItem["ItemID"]);
                            specialContent.Append("\" title=\"");
                            specialContent.Append(itemName);
                            specialContent.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                            specialContent.Append(drSpecialItem["ItemID"]);
                            specialContent.Append(",");
                            specialContent.Append(itemPriceValue);
                            specialContent.Append(",'");
                            specialContent.Append(itemSKU);
                            specialContent.Append("',");
                            specialContent.Append(1);
                            specialContent.Append(",'");
                            specialContent.Append(drSpecialItem["CostVariants"]);
                            specialContent.Append("',this);\">");
                            specialContent.Append(getLocale("Cart +"));
                            specialContent.Append("</button></label></div></div>");
                        }
                    }
                    if (GetCustomerID > 0 && GetUsername.ToLower() != "anonymoususer")
                    {
                        specialContent.Append("<div class=\"cssClassWishListButton\">");
                        specialContent.Append("<label class='i-wishlist cssWishListLabel cssClassDarkBtn'><button type=\"button\" id=\"addWishList\" onclick=AspxCommerce.RootFunction.CheckWishListUniqueness(");
                        specialContent.Append(drSpecialItem["ItemID"]);
                        specialContent.Append(",'");
                        specialContent.Append(drSpecialItem["SKU"]);
                        specialContent.Append("',this);><span>");
                        specialContent.Append(getLocale("Wishlist+"));
                        specialContent.Append("</span></button></label></div>");
                    }
                    else
                    {
                        specialContent.Append("<div class=\"cssClassWishListButton\">");
                        specialContent.Append("<label class='i-wishlist cssWishListLabel cssClassDarkBtn'><button type=\"button\" id=\"addWishList\" onclick=\"AspxCommerce.RootFunction.Login();\">");
                        specialContent.Append("<span>");
                        specialContent.Append(getLocale("Wishlist+"));
                        specialContent.Append("</span></button></label></div>");
                    }
                    specialContent.Append("<div class=\"cssClassWishListButton\">");
                    specialContent.Append("<input type=\"hidden\" name='itemwish' value=");
                    specialContent.Append(drSpecialItem["ItemID"]);
                    specialContent.Append(",'");
                    specialContent.Append(drSpecialItem["SKU"]);
                    specialContent.Append("',this  />");
                    specialContent.Append("</div>");
                    specialContent.Append("</div></div>");
                    specialContent.Append("</div></div>");
                    specialContent.Append("</div>");
                }

                specialContent.Append("</div>");
                if (nosOfSpecialItems > NoOfItemInRow)
                {
                    string strHtml = "<a href=\"" + aspxRedirectPath + SpecialDetailPage + pageExtension + "?id=special\">" + getLocale("View More") + "</a>";
                    divViewMoreSpecial.InnerHtml = strHtml;
                }
                ltrSpecialItems.Text = specialContent.ToString();
            }
            else
            {
                StringBuilder noSpl = new StringBuilder();
                noSpl.Append("<span class=\"cssClassNotFound\">");
                noSpl.Append(getLocale("No special item found in this store!"));
                noSpl.Append("</span>");
                divSpclBox.InnerHtml = noSpl.ToString();
                divSpclBox.Attributes.Add("class", "");
            }
            #endregion
        }
    }
예제 #3
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();
    }
예제 #4
0
    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();
    }
예제 #5
0
    public void GetHeavyDiscountItems()
    {
        hst = AppLocalized.getLocale(modulePath);
        List <HeavyDiscountInfo> lstHeavyDiscount     = AspxHeavyDiscountController.GetHeavyDiscountItems(aspxCommonObj, 1, NoOfItemShown);
        StringBuilder            heavyDiscountContent = new StringBuilder();

        if (lstHeavyDiscount != null && lstHeavyDiscount.Count > 0)
        {
            int rowTotal = 0;

            for (int index = 0; index < lstHeavyDiscount.Count; index++)
            {
                rowTotal = lstHeavyDiscount[index].RowTotal;
                string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + lstHeavyDiscount[index].ImagePath;
                if (lstHeavyDiscount[index].ImagePath == null || lstHeavyDiscount[index].ImagePath == "")
                {
                    imagePath = DefaultImagePath;
                }
                if (lstHeavyDiscount[index].AlternateText == "")
                {
                    lstHeavyDiscount[index].AlternateText = lstHeavyDiscount[index].Name;
                }
                string hrefItem = aspxRedirectPath + "item/" + lstHeavyDiscount[index].SKU + pageExtension;
                if ((index + 1) % NoOfItemShown == 0)
                {
                    heavyDiscountContent.Append("<div class=\"cssClassProductsBox cssClassProductsBoxNoMargin\">");
                }
                else
                {
                    heavyDiscountContent.Append("<div class=\"cssClassProductsBox\">");
                }
                decimal variantAddedSavingPercent = ((lstHeavyDiscount[index].ListPrice * Rate) - (lstHeavyDiscount[index].Price * Rate)) / (lstHeavyDiscount[index].ListPrice * Rate) * 100;
                decimal savPrice = Math.Round(variantAddedSavingPercent, 0);
                heavyDiscountContent.Append("<div id=\"hproductImageWrapID_");
                heavyDiscountContent.Append(lstHeavyDiscount[index].ItemID);
                heavyDiscountContent.Append("\" class=\"cssClassProductsBoxInfo\" costvariantItem=\"");
                heavyDiscountContent.Append(lstHeavyDiscount[index].IsCostVariantItem);
                heavyDiscountContent.Append("\" itemid=\"");
                heavyDiscountContent.Append(lstHeavyDiscount[index].ItemID + "\">");
                heavyDiscountContent.Append("<h2><a href=\"");
                heavyDiscountContent.Append(hrefItem);
                heavyDiscountContent.Append("\" title=\"" + lstHeavyDiscount[index].Name + "\">");
                string name = string.Empty;
                if (lstHeavyDiscount[index].Name.Length > 50)
                {
                    name = lstHeavyDiscount[index].Name.Substring(0, 50);
                    int i = 0;
                    i    = name.LastIndexOf(' ');
                    name = name.Substring(0, i);
                    name = name + "...";
                }
                else
                {
                    name = lstHeavyDiscount[index].Name;
                }
                heavyDiscountContent.Append(name);
                heavyDiscountContent.Append("</a></h2><h3>");
                heavyDiscountContent.Append(lstHeavyDiscount[index].SKU);
                heavyDiscountContent.Append("</h3><div class=\"cssClassYouSave\"><span class=\"spanSaving\"><b>");
                heavyDiscountContent.Append(savPrice);
                heavyDiscountContent.Append("%</b>" + getLocale("Off") + "</span></div>");
                heavyDiscountContent.Append("<div class=\"cssClassProductPicture\"><a href=\"");
                heavyDiscountContent.Append(hrefItem);
                heavyDiscountContent.Append("\"><img alt=\"");
                heavyDiscountContent.Append(lstHeavyDiscount[index].AlternateText);
                heavyDiscountContent.Append("\" title=\"");
                heavyDiscountContent.Append(lstHeavyDiscount[index].AlternateText);
                heavyDiscountContent.Append("\"  src=\"");
                heavyDiscountContent.Append(aspxRootPath);
                heavyDiscountContent.Append(imagePath.Replace("uploads", "uploads/Medium"));
                heavyDiscountContent.Append("\"></a></div>");

                if (!(bool)lstHeavyDiscount[index].HidePrice)
                {
                    heavyDiscountContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                    heavyDiscountContent.Append("<p class=\"cssClassProductOffPrice\"><span class=\"cssClassFormatCurrency\" value=\"");
                    heavyDiscountContent.Append(Math.Round(lstHeavyDiscount[index].ListPrice, 2));
                    heavyDiscountContent.Append("\">");
                    heavyDiscountContent.Append(Math.Round((lstHeavyDiscount[index].ListPrice * Rate), 2));
                    heavyDiscountContent.Append("</span></p><p class=\"cssClassProductRealPrice\"><span class=\"cssClassFormatCurrency\" value=\"");
                    heavyDiscountContent.Append(Math.Round(lstHeavyDiscount[index].Price, 2));
                    heavyDiscountContent.Append("\">");
                    heavyDiscountContent.Append(Math.Round((lstHeavyDiscount[index].Price * Rate), 2));
                    heavyDiscountContent.Append("</span></p></div></div>");
                }
                else
                {
                    heavyDiscountContent.Append("<div class=\"cssClassProductPriceBox\"></div>");
                }
                heavyDiscountContent.Append("<div class=\"cssClassProductDetail\"><p><a href=\"");
                heavyDiscountContent.Append(aspxRedirectPath);
                heavyDiscountContent.Append("item/");
                heavyDiscountContent.Append(lstHeavyDiscount[index].SKU + pageExtension);
                heavyDiscountContent.Append("\">Details</a></p></div>");
                heavyDiscountContent.Append("<div class=\"sfButtonwrapper\">");
                //if (AllowWishListHeavyDIscountItem.ToLower() == "true")
                //{

                //    if (aspxCommonObj.CustomerID > 0 && aspxCommonObj.UserName.ToLower() != "anonymoususer")
                //    {
                //        heavyDiscountContent.Append("<div class=\"cssClassWishListButton\">");
                //        heavyDiscountContent.Append("<button type=\"button\" id=\"addWishList\" onclick=\"HeavyDiscountItems.CheckWishListUniqueness(");
                //        heavyDiscountContent.Append(lstHeavyDiscount[index].ItemID);
                //        heavyDiscountContent.Append(");\"><span><span><span>+</span>Wishlist</span></span></button></div>");

                //    }
                //    else
                //    {
                //        heavyDiscountContent.Append("<div class=\"cssClassWishListButton\"><button type=\"button\" id=\"addWishList\" onclick=\"AspxCommerce.RootFunction.Login();\">");
                //        heavyDiscountContent.Append("<span><span><span>+</span>Wishlist</span></span></button></div>");
                //    }
                //}
                //if (AllowAddToCompareHeavyDiscount.ToLower() == "true")
                //{
                //    heavyDiscountContent.Append("<div class=\"cssClassCompareButton\"><button type=\"button\" id=\"btnAddCompare\" onclick=\"HeavyDiscountItems.AddItemsToCompare(");
                //    heavyDiscountContent.Append(lstHeavyDiscount[index].ItemID);
                //    heavyDiscountContent.Append(");\"><span><span><span>+</span>Compare</span></span></button></div>");
                //}
                heavyDiscountContent.Append("</div><div class=\"cssClassclear\"></div>");

                if (AllowOutStockPurchase.ToLower() == "false")
                {
                    if ((bool)lstHeavyDiscount[index].IsOutOfStock)
                    {
                        heavyDiscountContent.Append(
                            "</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper cssClassOutOfStock\"><button type=\"button\"><span>" +
                            getLocale("Out Of Stock") + "</span></button></div></div>");
                    }
                    else
                    {
                        heavyDiscountContent.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\"><button type=\"button\" title=\"");
                        heavyDiscountContent.Append(lstHeavyDiscount[index].Name);
                        heavyDiscountContent.Append("\" onclick=\"HeavyDiscountItems.AddToCartToJS(");
                        heavyDiscountContent.Append(lstHeavyDiscount[index].ItemID + ",");
                        heavyDiscountContent.Append(Math.Round(lstHeavyDiscount[index].Price, 2) + ",");
                        heavyDiscountContent.Append("'" + lstHeavyDiscount[index].SKU + "'" + "," + 1);
                        heavyDiscountContent.Append(");\"><span><span>" + getLocale("Add To Cart") +
                                                    "</span></span></button></div></div>");
                    }
                }
                else
                {
                    heavyDiscountContent.Append("</div><div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\"><button type=\"button\" title=\"");
                    heavyDiscountContent.Append(lstHeavyDiscount[index].Name);
                    heavyDiscountContent.Append("\" onclick=\"HeavyDiscountItems.AddToCartToJS(");
                    heavyDiscountContent.Append(lstHeavyDiscount[index].ItemID + ",");
                    heavyDiscountContent.Append(Math.Round(lstHeavyDiscount[index].Price, 2) + ",");
                    heavyDiscountContent.Append("'" + lstHeavyDiscount[index].SKU + "'" + "," + 1);
                    heavyDiscountContent.Append(");\"><span><span>" + getLocale("Add To Cart") + "</span></span></button></div></div>");
                }
                heavyDiscountContent.Append("</div>");
            }
            if (rowTotal > NoOfItemShown)
            {
                heavyDiscountContent.Append("<div id=\"divViewMoreExplored\" class=\"cssClassViewMore\"><a href=\"");
                heavyDiscountContent.Append(aspxRedirectPath + "Details-View" + pageExtension);
                heavyDiscountContent.Append("?id=heavy\">" + getLocale("View More") + "</a></div>");
            }
        }
        else
        {
            heavyDiscountContent.Append("<span class=\"cssClassNotFound\">" +
                                        getLocale("This store has no items listed yet!") + "</span>");
        }
        heavyDiscontHeader.InnerHtml = getLocale("Heavy Discount");
        ltrHeavyDiscount.Text        = heavyDiscountContent.ToString();
    }
    public void BindWishListItem()
    {
        decimal        rate          = 1;
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = StoreID;
        aspxCommonObj.PortalID    = PortalID;
        aspxCommonObj.UserName    = UserName;
        aspxCommonObj.CultureName = CultureName;
        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());
            }
        }
        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; //get value from drop down
        int offset = 1;
        int sortBy = 1; // get value from drop down
        List <WishItemsInfo> lstWishList       = AspxWishItemController.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(
                "<td class=\"cssClassWishItemChkbox\"> <input type=\"checkbox\" id=\"chkHeading\"/></td>");
            wishListStringBld.Append(
                "<td class=\"cssClassWishItemDetails\"><label id=\"lblItem\" class=\"sfLocale\">Item</label></td>");
            wishListStringBld.Append(
                "<td class=\"row-variants\"><label id=\"lblVariant\" class=\"sfLocale\">Variants</label></td>");
            wishListStringBld.Append(
                "<td class=\"cssClassWishListComment\"><label id=\"lblComment\" class=\"sfLocale\">Comment</label></td>");
            wishListStringBld.Append(
                "<td class=\"cssClassAddedOn\"><label id=\"lblAddedOn\" class=\"sfLocale\">Added On</label></td>");
            wishListStringBld.Append(
                "<td class=\"cssClassAddToCart\"><label id=\"lblAddToCart\" class=\"sfLocale\">Add To Cart</label></td>");
            wishListStringBld.Append("<td class=\"cssClassDelete\"></td>");
            wishListStringBld.Append("</tr></thead>");
            wishListStringBld.Append("<tbody>");
            ArrayLength = lstWishList.Count;
            foreach (var response in lstWishList)
            {
                // ArrItemListType.Add(response.ItemID);

                RowTotal = response.RowTotal;
                string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + response.ImagePath;
                if (response.ImagePath == "")
                {
                    imagePath = NoImageWishList;
                }
                else if (response.AlternateText == "")
                {
                    response.AlternateText = response.ItemName;
                }
                JavaScriptSerializer ser = new JavaScriptSerializer();
                string WishDate          = (Convert.ToDateTime(response.WishDate)).ToShortDateString();
                //WishList.DateDeserialize(response.WishDate, "yyyy/M/d");
                var itemSKU    = ser.Serialize(response.SKU); //JSON2.stringify(response.SKU);
                var cosVaraint = ser.Serialize(response.CostVariantValueIDs);
                //JSON2.stringify(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 + "";
                }
                if (lstWishList.IndexOf(response) % 2 == 0)
                {
                    if (AllowOutStockPurchase.ToLower() == "false")
                    {
                        if (response.IsOutOfStock != null && (bool)response.IsOutOfStock)
                        {
                            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>");
                            wishListStringBld.Append("<td class=\"cssClassWishItemDetails\">");
                            wishListStringBld.Append("<div class=\"cssClassImage\">");
                            wishListStringBld.Append("<img src=\"" + aspxRootPath +
                                                     imagePath.Replace("uploads", "uploads/Small") +
                                                     "\" alt=\"" + response.AlternateText + "\" title=\"" +
                                                     response.AlternateText + "\"/>");
                            wishListStringBld.Append("</div>");
                            wishListStringBld.Append("<a href=\"" + href + "\">" + response.ItemName + "</a></br>");
                            wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                     Math.Round(decimal.Parse(response.Price) * rate, 2) + "</span></td>");
                            wishListStringBld.Append(
                                "<td><input type=\"hidden\" name=\"hdnCostVariandValueIDS\" value=" + cosVaraint + "/>");
                            wishListStringBld.Append("<span>" + response.ItemCostVariantValue + "</span></td>");
                            wishListStringBld.Append("<td class=\"cssClassWishComment\">");
                            wishListStringBld.Append("<textarea maxlength=\"300\" onkeyup=\"" +
                                                     "WishList.ismaxlength(this)" + "\" id=\"comment_" +
                                                     response.WishItemID + "\" class=\"comment\">" + response.Comment +
                                                     "</textarea></td>");
                            wishListStringBld.Append("<td class=\"cssClassWishDate\">" + WishDate + "</td>");
                            wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                            wishListStringBld.Append("<div class=\"sfButtonwrapper cssClassOutOfStock\">");
                            wishListStringBld.Append("<a href=\"#\"><span>" + getLocale("Out Of Stock") +
                                                     "</span></a></div></td>");
                            wishListStringBld.Append("<td class=\"cssClassDelete\">");
                            wishListStringBld.Append("<img onclick=\"WishList.DeleteWishListItem(" + response.WishItemID +
                                                     ")\" src=\"" + aspxTemplateFolderPath +
                                                     "/images/admin/btndelete.png\"/>");
                            wishListStringBld.Append("</td></tr>");
                        }
                        else
                        {
                            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>");
                            wishListStringBld.Append("<td class=\"cssClassWishItemDetails\">");
                            wishListStringBld.Append("<div class=\"cssClassImage\">");
                            wishListStringBld.Append("<img src=\"" + aspxRootPath +
                                                     imagePath.Replace("uploads", "uploads/Small") +
                                                     "\" alt=\"" + response.AlternateText + "\" title=\"" +
                                                     response.AlternateText + "\"/>");
                            wishListStringBld.Append("</div>");
                            wishListStringBld.Append("<a href=\"" + href + "\">" + response.ItemName + "</a></br>");
                            wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                     Math.Round(decimal.Parse(response.Price) * rate, 2) + "</span></td>");
                            wishListStringBld.Append(
                                "<td><input type=\"hidden\" name=\"hdnCostVariandValueIDS\" value=" + cosVaraint + "/>");
                            wishListStringBld.Append("<span>" + response.ItemCostVariantValue + "</span></td>");
                            wishListStringBld.Append("<td class=\"cssClassWishComment\">");
                            wishListStringBld.Append("<textarea maxlength=\"300\" onkeyup=\"" +
                                                     "WishList.ismaxlength(this)" + "\" id=\"comment_" +
                                                     response.WishItemID + "\" class=\"comment\">" + response.Comment +
                                                     "</textarea></td>");
                            wishListStringBld.Append("<td class=\"cssClassWishDate\">" + WishDate + "</td>");
                            wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                            wishListStringBld.Append("<div class=\"sfButtonwrapper\">");
                            wishListStringBld.Append("<a href=\"" + cartUrl + "\" onclick=WishList.AddToCartToJS(" +
                                                     response.ItemID + "," + response.Price + "," + itemSKU + "," + 1 +
                                                     ");><span>" + getLocale("Add To Cart") +
                                                     "</span></a></div></td>");
                            wishListStringBld.Append("<td class=\"cssClassDelete\">");
                            wishListStringBld.Append("<img onclick=\"WishList.DeleteWishListItem(" + response.WishItemID +
                                                     ")\" src=\"" + aspxTemplateFolderPath +
                                                     "/images/admin/btndelete.png\"/>");
                            wishListStringBld.Append("</td></tr>");
                        }
                    }
                    else
                    {
                        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>");
                        wishListStringBld.Append("<td class=\"cssClassWishItemDetails\">");
                        wishListStringBld.Append("<div class=\"cssClassImage\">");
                        wishListStringBld.Append("<img src=\"" + aspxRootPath +
                                                 imagePath.Replace("uploads", "uploads/Small") + "\" alt=\"" +
                                                 response.AlternateText + "\" title=\"" + response.AlternateText +
                                                 "\"/>");
                        wishListStringBld.Append("</div>>");
                        wishListStringBld.Append("<a href=\"" + href + "\">" + response.ItemName + "</a><br>");
                        wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                 Math.Round(decimal.Parse(response.Price) * rate, 2) + "</span></td>");
                        wishListStringBld.Append("<td><input type=\"hidden\" name=\"hdnCostVariandValueIDS\" value=" +
                                                 cosVaraint + "/>");
                        wishListStringBld.Append("<span>" + response.ItemCostVariantValue + "</span></td>");
                        wishListStringBld.Append("<td class=\"cssClassWishComment\">");
                        wishListStringBld.Append("<textarea maxlength=\"300\" onkeyup=\"" + "WishList.ismaxlength(this)" +
                                                 "\" id=\"comment_" + response.WishItemID + "\" class=\"comment\">" +
                                                 response.Comment + "</textarea></td>");
                        wishListStringBld.Append("<td class=\"cssClassWishDate\">" + WishDate + "</td>");
                        wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                        wishListStringBld.Append("<div class=\"sfButtonwrapper\">");
                        wishListStringBld.Append("<a href=" + cartUrl + " onclick=WishList.AddToCartToJS(" +
                                                 response.ItemID + "," + response.Price + "," + itemSKU + "," + 1 +
                                                 ");><span>" + getLocale("Add To Cart") + "</span></a></div></td>");
                        wishListStringBld.Append("<td class=\"cssClassDelete\">");
                        wishListStringBld.Append("<img onclick=\"WishList.DeleteWishListItem(" + response.WishItemID +
                                                 ")\" src=\"" + aspxTemplateFolderPath +
                                                 "/images/admin/btndelete.png\"/>");
                        wishListStringBld.Append("</td></tr>");
                    }
                }
                else
                {
                    if (AllowOutStockPurchase.ToLower() == "false")
                    {
                        if (response.IsOutOfStock != null && (bool)response.IsOutOfStock)
                        {
                            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>");
                            wishListStringBld.Append("<td class=\"cssClassWishItemDetails\">");
                            wishListStringBld.Append("<div class=\"cssClassImage\">");
                            wishListStringBld.Append("<img src=\"" + aspxRootPath +
                                                     imagePath.Replace("uploads", "uploads/Small") +
                                                     "\" alt=\"" + response.AlternateText + "\" title=\"" +
                                                     response.AlternateText + "\"/>");
                            wishListStringBld.Append("</div>");
                            wishListStringBld.Append("<a href=\"" + href + "\">" + response.ItemName + "</a></br>");
                            wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                     Math.Round(decimal.Parse(response.Price) * rate, 2) + "</span></td>");
                            wishListStringBld.Append(
                                "<td><input type=\"hidden\" name=\"hdnCostVariandValueIDS\" value=" + cosVaraint + "/>");
                            wishListStringBld.Append("<span>" + response.ItemCostVariantValue + "</span></td>");
                            wishListStringBld.Append("<td class=\"cssClassWishComment\">");
                            wishListStringBld.Append("<textarea maxlength=\"300\" onkeyup=\"" +
                                                     "WishList.ismaxlength(this)" + "\" id=\"comment_" +
                                                     response.WishItemID + "\" class=\"comment\">" + response.Comment +
                                                     "</textarea></td>");
                            wishListStringBld.Append("<td class=\"cssClassWishDate\">" + WishDate + "</td>");
                            wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                            wishListStringBld.Append("<div class=\"sfButtonwrapper cssClassOutOfStock\">");
                            wishListStringBld.Append("<a href=\"#\"><span>" + getLocale("Out Of Stock") +
                                                     "</span></a></div></td>");
                            wishListStringBld.Append("<td class=\"cssClassDelete\">");
                            wishListStringBld.Append("<img onclick=\"WishList.DeleteWishListItem(" + response.WishItemID +
                                                     ")\" src=\"" + aspxTemplateFolderPath +
                                                     "/images/admin/btndelete.png\"/>");
                            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>");
                            wishListStringBld.Append("<td class=\"cssClassWishItemDetails\">");
                            wishListStringBld.Append("<div class=\"cssClassImage\">");
                            wishListStringBld.Append("<img src=\"" + aspxRootPath +
                                                     imagePath.Replace("uploads", "uploads/Small") +
                                                     "\" alt=\"" + response.AlternateText + "\" title=\"" +
                                                     response.AlternateText + "\"/>");
                            wishListStringBld.Append("</div>");
                            wishListStringBld.Append("<a href=\"" + href + "\">" + response.ItemName + "</a></br>");
                            wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                     Math.Round(decimal.Parse(response.Price) * rate, 2) + "</span></td>");
                            wishListStringBld.Append(
                                "<td><input type=\"hidden\" name=\"hdnCostVariandValueIDS\" value=" + cosVaraint + "/>");
                            wishListStringBld.Append("<span>" + response.ItemCostVariantValue + "</span></td>");
                            wishListStringBld.Append("<td class=\"cssClassWishComment\">");
                            wishListStringBld.Append("<textarea maxlength=\"300\" onkeyup=\"" +
                                                     "WishList.ismaxlength(this)" + "\" id=\"comment_" +
                                                     response.WishItemID + "\" class=\"comment\">" + response.Comment +
                                                     "</textarea></td>");
                            wishListStringBld.Append("<td class=\"cssClassWishDate\">" + WishDate + "</td>");
                            wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                            wishListStringBld.Append("<div class=\"sfButtonwrapper\">");
                            wishListStringBld.Append("<a href=" + cartUrl + " onclick=WishList.AddToCartToJS(" +
                                                     response.ItemID + "," + response.Price + "," + itemSKU + "," + 1 +
                                                     ");><span>" + getLocale("Add To Cart") +
                                                     "</span></a></div></td>");
                            wishListStringBld.Append("<td class=\"cssClassDelete\">");
                            wishListStringBld.Append("<img onclick=\"WishList.DeleteWishListItem(" + response.WishItemID +
                                                     ")\" src=\"" + aspxTemplateFolderPath +
                                                     "/images/admin/btndelete.png\"/>");
                            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>");
                        wishListStringBld.Append("<td class=\"cssClassWishItemDetails\">");
                        wishListStringBld.Append("<div class=\"cssClassImage\">");
                        wishListStringBld.Append("<img src=\"" + aspxRootPath +
                                                 imagePath.Replace("uploads", "uploads/Small") + "\" alt=\"" +
                                                 response.AlternateText + "\" title=\"" + response.AlternateText +
                                                 "\"/>");
                        wishListStringBld.Append("</div>");
                        wishListStringBld.Append("<a href=\"" + href + "\">" + response.ItemName + "</a></br>");
                        wishListStringBld.Append("<span class=\"cssClassPrice cssClassFormatCurrency\">" +
                                                 Math.Round(decimal.Parse(response.Price) * rate, 2) + "</span></td>");
                        wishListStringBld.Append("<td><input type=\"hidden\" name=\"hdnCostVariandValueIDS\" value=" +
                                                 cosVaraint + "/>");
                        wishListStringBld.Append("<span>" + response.ItemCostVariantValue + "</span></td>");
                        wishListStringBld.Append("<td class=\"cssClassWishComment\">");
                        wishListStringBld.Append("<textarea maxlength=\"300\" onkeyup=\"" + "WishList.ismaxlength(this)" +
                                                 "\" id=\"comment_" + response.WishItemID + "\" class=\"comment\">" +
                                                 response.Comment + "</textarea></td>");
                        wishListStringBld.Append("<td class=\"cssClassWishDate\">" + WishDate + "</td>");
                        wishListStringBld.Append("<td class=\"cssClassWishToCart\">");
                        wishListStringBld.Append("<div class=\"sfButtonwrapper\">");
                        wishListStringBld.Append("<a href=" + cartUrl + " onclick=WishList.AddToCartToJS(" +
                                                 response.ItemID + "," + response.Price + "," + itemSKU + "," + 1 +
                                                 ");><span>" + getLocale("Add To Cart") + "</span></a></div></td>");
                        wishListStringBld.Append("<td class=\"cssClassDelete\">");
                        wishListStringBld.Append("<img onclick=\"WishList.DeleteWishListItem(" + response.WishItemID +
                                                 ")\" src=\"" + aspxTemplateFolderPath +
                                                 "/images/admin/btndelete.png\"/>");
                        wishListStringBld.Append("</td></tr>");
                    }
                }
            }
            wishListStringBld.Append("</tbody>");
            wishListStringBld.Append(GetStringScript("$('.cssClassImage img[title]').tipsy({ gravity: 'n' });"));
            StringBuilder wishLstButtonBdl = new StringBuilder();
            wishLstButtonBdl.Append("<button type=\"button\" id=\"shareWishList\">");
            wishLstButtonBdl.Append("<span><span class=\"sfLocale\">Share Wishlist</span></span></button>");
            wishLstButtonBdl.Append(
                "<button type=\"button\" id=\"updateWishList\" onclick=\"WishList.UpdateWishList();\">");
            wishLstButtonBdl.Append("<span><span class=\"sfLocale\">Update Selected</span></span></button>");
            wishLstButtonBdl.Append(
                "<button type=\"button\" id=\"clearWishList\" onclick=\"WishList.ClearWishList();\">");
            wishLstButtonBdl.Append("<span><span class=\"sfLocale\">Clear WishList</span></span></button>");
            wishLstButtonBdl.Append("<button type=\"button\" id=\"btnDeletedMultiple\">");
            wishLstButtonBdl.Append("");
            wishLstButtonBdl.Append("<span><span class=\"sfLocale\">Delete Selected</span></span></button>");
            wishLstButtonBdl.Append("<button type=\"button\" id=\"continueInStore\">");
            wishLstButtonBdl.Append("<span><span class=\"sfLocale\">Continue to Shopping</span></span></button >");

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

            //StringBuilder wishListSortByBdl = new StringBuilder();
            //wishListSortByBdl.Append("<span class=\"sfLocale\">Sort by:</span><select id=\"ddlWishListSortBy\" class=\"sfListmenu\"><option value=\"\"></option></select>");
            //ltrWishListSortBy.Text = wishListSortByBdl.ToString();

            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();
    }
예제 #7
0
    public void GetSpecialItems()
    {
        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;
        int    rowTotal                         = 0;
        SpecialItemsController  sic             = new SpecialItemsController();
        List <SpecialItemsInfo> lstSpecialItems = sic.GetSpecialItems(aspxCommonObj, NoOfSpecialItems);

        rowTotal = lstSpecialItems.Count;
        if (rowTotal > NoOfSpecialItems)
        {
            lstSpecialItems.RemoveAt(lstSpecialItems.Count - 1);
        }
        StringBuilder specialContent = new StringBuilder();

        if (lstSpecialItems != null && lstSpecialItems.Count > 0)
        {
            specialContent.Append("<div class=\"cssClassSpecialBoxInfo\" id=\"divSpItem\">");
            foreach (SpecialItemsInfo item in lstSpecialItems)
            {
                string imagePath    = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.ImagePath;
                string altImagePath = "";// "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.AlternateImagePath;
                if (item.ImagePath == "")
                {
                    imagePath = DefaultImagePath;
                }
                else
                {
                    //Resize Image Dynamically
                    InterceptImageController.ImageBuilder(item.ImagePath, ImageType.Medium, ImageCategoryType.Item, aspxCommonObj);
                }
                if (item.AlternateText == "")
                {
                    item.AlternateText = item.Name;
                }
                if (item.ImagePath == "")
                {
                    altImagePath = imagePath;
                }
                string itemPrice      = Math.Round(double.Parse((item.Price).ToString()), 2).ToString("N2");
                string itemPriceValue = Math.Round(double.Parse((item.Price).ToString()), 2).ToString();
                string itemPriceRate  = Math.Round(double.Parse((item.Price).ToString()), 2).ToString("N2");

                if ((lstSpecialItems.IndexOf(item) + 1) % NoOfItemInRow == 0)
                {
                    specialContent.Append("<div class=\"cssClassProductsBox cssClassNoMargin\">");
                }
                else
                {
                    specialContent.Append("<div class=\"cssClassProductsBox\">");
                }
                var hrefItem = aspxRedirectPath + "item/" + fixedEncodeURIComponent(item.SKU) + pageExtension;
                specialContent.Append("<div id=\"productImageWrapID_");
                specialContent.Append(item.ItemID);
                specialContent.Append("\" class=\"cssClassProductsBoxInfo\" costvariantItem=");
                specialContent.Append(item.CostVariants);
                specialContent.Append("  itemid=\"");
                specialContent.Append(item.ItemID);
                specialContent.Append("\">");
                specialContent.Append("<h3>");
                specialContent.Append(item.SKU);
                specialContent.Append("</h3><div class=\"divQuickLookonHover\"><div class=\"divitemImage cssClassProductPicture\"><a href=\"");
                specialContent.Append(hrefItem);
                specialContent.Append("\" ><img id=\"img_");
                specialContent.Append(item.ItemID);
                specialContent.Append("\"  alt=\"");
                specialContent.Append(item.AlternateText);
                specialContent.Append("\"  title=\"");
                specialContent.Append(item.AlternateText);
                specialContent.Append("\"");
                specialContent.Append("src=\"");
                specialContent.Append(aspxRootPath);
                specialContent.Append(imagePath.Replace("uploads", "uploads/Medium"));
                specialContent.Append("\" orignalPath=\"");
                specialContent.Append(imagePath.Replace("uploads", "uploads/Medium"));
                specialContent.Append("\" altImagePath=\"");
                specialContent.Append(altImagePath.Replace("uploads", "uploads/Medium"));
                specialContent.Append("\"/></a></div>");
                specialContent.Append("<div class='cssLatestItemInfo clearfix'>");
                specialContent.Append("<h2><a href=\"");
                specialContent.Append(hrefItem);
                specialContent.Append("\" title=\"" + item.Name + "\">");

                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;
                }
                specialContent.Append(name);
                specialContent.Append("</a></h2>");
                StringBuilder dataContent = new StringBuilder();
                dataContent.Append("data-class=\"addtoCart\" data-ItemTypeID=\"" + item.ItemTypeID + "\" data-type=\"button\" data-ItemID=\"" + item.ItemID + "\" data-addtocart=\"");
                dataContent.Append("addtocart");
                dataContent.Append(item.ItemID);
                dataContent.Append("\" data-title=\"");
                dataContent.Append(name);
                dataContent.Append("\" data-onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                dataContent.Append(item.ItemID);
                dataContent.Append(",");
                dataContent.Append(itemPriceValue);
                dataContent.Append(",'");
                dataContent.Append(item.SKU);
                dataContent.Append("',");
                dataContent.Append(1);
                dataContent.Append(",'");
                dataContent.Append(item.CostVariants);
                dataContent.Append("',this);\"");
                if (item.HidePrice != true)
                {
                    if (item.ListPrice != null)
                    {//Added for group type products
                        if (item.ItemTypeID == 5)
                        {
                            specialContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                            specialContent.Append("<p class=\"cssClassProductRealPrice \">");
                            specialContent.Append(getLocale("Starting At"));
                            specialContent.Append("<span class=\"cssClassFormatCurrency\">");
                            specialContent.Append(itemPriceRate);
                            specialContent.Append("</span></p></div></div>");
                        }
                        else
                        {
                            string strAmount = Math.Round((double)(item.ListPrice), 2).ToString("N2");
                            specialContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                            specialContent.Append("<p class=\"cssClassProductOffPrice\">");
                            specialContent.Append("<span class=\"cssClassFormatCurrency\">");
                            specialContent.Append(strAmount);
                            specialContent.Append("</span></p><p class=\"cssClassProductRealPrice \">");
                            specialContent.Append("<span class=\"cssClassFormatCurrency\">");
                            specialContent.Append(itemPriceRate);
                            specialContent.Append("</span></p></div></div>");
                        }
                    }
                    else
                    {
                        if (item.ItemTypeID == 5)
                        {
                            specialContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                            specialContent.Append("<p class=\"cssClassProductRealPrice \" >");
                            specialContent.Append(getLocale("Starting At"));
                            specialContent.Append("<span class=\"cssClassFormatCurrency\">");
                            specialContent.Append(itemPriceRate);
                            specialContent.Append("</span></p></div></div>");
                        }
                        else
                        {
                            specialContent.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                            specialContent.Append("<p class=\"cssClassProductRealPrice \" >");
                            specialContent.Append("<span class=\"cssClassFormatCurrency\">");
                            specialContent.Append(itemPriceRate);
                            specialContent.Append("</span></p></div></div>");
                        }
                    }
                }
                else
                {
                    specialContent.Append("<div class=\"cssClassProductPriceBox\"></div>");
                }

                specialContent.Append("<div class=\"cssClassProductDetail\"><p><a href=\"");
                specialContent.Append(aspxRedirectPath);
                specialContent.Append("item/");
                specialContent.Append(item.SKU);
                specialContent.Append(pageExtension);
                specialContent.Append("\">");
                specialContent.Append(getLocale("Details"));
                specialContent.Append("</a></p></div>");

                specialContent.Append("<div class=\"sfQuickLook\" style=\"display:none\">");
                specialContent.Append("<img itemId=\"");
                specialContent.Append(item.ItemID);
                specialContent.Append("\" sku=\"");
                specialContent.Append(item.SKU);
                specialContent.Append("\" src=\"");
                specialContent.Append(aspxTemplateFolderPath);
                specialContent.Append("/images/QV_Button.png\" alt=\"\" rel=\"popuprel\" />");
                specialContent.Append("</div>");
                if (item.AttributeValues != null)
                {
                    if (item.AttributeValues != "")
                    {
                        specialContent.Append("<div class=\"cssGridDyanamicAttr\">");
                        string[] attributeValues = item.AttributeValues.Split(',');
                        foreach (string element in attributeValues)
                        {
                            string[] attributes     = element.Split('#');
                            string   attributeName  = attributes[0];
                            string   attributeValue = attributes[1];
                            int      inputType      = Int32.Parse(attributes[2]);
                            string   validationType = attributes[3];
                            specialContent.Append("<div class=\"cssDynamicAttributes\">");
                            specialContent.Append("<div class=\"cssDynamicAttributes\">");
                            specialContent.Append("<span>");
                            specialContent.Append(attributeName);
                            specialContent.Append("</span> :");
                            if (inputType == 7)
                            {
                                specialContent.Append("<span class=\"cssClassFormatCurrency\">");
                            }
                            else
                            {
                                specialContent.Append("<span>");
                            }
                            specialContent.Append(attributeValue);
                            specialContent.Append("</span></div>");
                        }
                        specialContent.Append("</div>");
                    }
                }
                string itemSKU  = item.SKU;
                string itemName = item.Name;

                specialContent.Append("<div class=\"cssClassTMar20\">");
                if (AllowAddToCart.ToLower() == "true")
                {
                    if (AllowOutStockPurchase.ToLower() == "false")
                    {
                        if (item.IsOutOfStock == true)
                        {
                            specialContent.Append("<div class=\"cssClassAddtoCard\"><div " + dataContent + " class=\"sfButtonwrapper cssClassOutOfStock\">");
                            specialContent.Append("<button type=\"button\"><span>");
                            specialContent.Append(getLocale("Out Of Stock"));
                            specialContent.Append("</span></button></div></div>");
                        }
                        else
                        {
                            specialContent.Append("<div class=\"cssClassAddtoCard\"><div " + dataContent + " class=\"sfButtonwrapper\">");
                            specialContent.Append("<label class='i-cart cssClassCartLabel cssClassGreenBtn'><button type=\"button\" class=\"addtoCart\"");
                            specialContent.Append("data-addtocart=\"");
                            specialContent.Append("addtocart");
                            specialContent.Append(item.ItemID);
                            specialContent.Append("\" title=\"");
                            specialContent.Append(itemName);
                            specialContent.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                            specialContent.Append(item.ItemID);
                            specialContent.Append(",");
                            specialContent.Append(itemPriceValue);
                            specialContent.Append(",'");
                            specialContent.Append(itemSKU);
                            specialContent.Append("',");
                            specialContent.Append(1);
                            specialContent.Append(",'");
                            specialContent.Append(item.CostVariants);
                            specialContent.Append("',this);\">");
                            specialContent.Append(getLocale("Cart +"));
                            specialContent.Append("</button></label></div></div>");
                        }
                    }
                    else
                    {
                        specialContent.Append("<div class=\"cssClassAddtoCard\"><div " + dataContent + " class=\"sfButtonwrapper\">");
                        specialContent.Append("<label class='i-cart cssClassCartLabel cssClassGreenBtn'><button type=\"button\" class=\"addtoCart\"");
                        specialContent.Append("data-addtocart=\"");
                        specialContent.Append("addtocart");
                        specialContent.Append(item.ItemID);
                        specialContent.Append("\" title=\"");
                        specialContent.Append(itemName);
                        specialContent.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                        specialContent.Append(item.ItemID);
                        specialContent.Append(",");
                        specialContent.Append(itemPriceValue);
                        specialContent.Append(",'");
                        specialContent.Append(itemSKU);
                        specialContent.Append("',");
                        specialContent.Append(1);
                        specialContent.Append(",'");
                        specialContent.Append(item.CostVariants);
                        specialContent.Append("',this);\">");
                        specialContent.Append(getLocale("Cart +"));
                        specialContent.Append("</button></label></div></div>");
                    }
                }
                specialContent.Append("<div class=\"cssClassWishListButton\">");
                specialContent.Append("<input type=\"hidden\" name='itemwish' value=");
                specialContent.Append(item.ItemID);
                specialContent.Append(",'");
                specialContent.Append(item.SKU);
                specialContent.Append("',this  />");
                specialContent.Append("</div>");
                specialContent.Append("</div></div>");
                specialContent.Append("</div></div>");
                specialContent.Append("</div>");
            }

            specialContent.Append("</div>");
            if (rowTotal > NoOfItemInRow)
            {
                string strHtml = "<a href=\"" + aspxRedirectPath + SpecialDetailPage + pageExtension + "?id=special\">" + getLocale("View More") + "</a>";
                divViewMoreSpecial.InnerHtml = strHtml;
            }
            ltrSpecialItems.Text = specialContent.ToString();
        }
        else
        {
            StringBuilder noSpl = new StringBuilder();
            noSpl.Append("<span class=\"cssClassNotFound\">");
            noSpl.Append(getLocale("No special item found in this store!"));
            noSpl.Append("</span>");
            divSpclBox.InnerHtml = noSpl.ToString();
            divSpclBox.Attributes.Add("class", "");
        }
    }
    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();
    }
예제 #9
0
    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>");
        }
    }
예제 #10
0
    private void GetLatestItemsByCount(AspxCommonInfo aspxCommonObj)
    {
        AspxLatestItemsController objLatestItems = new AspxLatestItemsController();
        DataSet ds = new DataSet();

        ds = objLatestItems.GetLatestItemsInfo(aspxCommonObj);
        if (ds != null && ds.Tables != null && ds.Tables.Count > 0)
        {
            DataTable dtSettings = ds.Tables[0];
            if (dtSettings != null && dtSettings.Rows.Count > 0)
            {
                NoOfLatestItems       = int.Parse(dtSettings.Rows[0]["LatestItemCount"].ToString());
                EnableLatestItemRss   = bool.Parse(dtSettings.Rows[0]["IsEnableLatestRss"].ToString());
                NoOfLatestItemsInARow = int.Parse(dtSettings.Rows[0]["LatestItemInARow"].ToString());
                RssFeedUrl            = dtSettings.Rows[0]["LatestItemRssPage"].ToString();
            }

            StringBuilder RecentItemContents = new StringBuilder();
            string        modulePath         = this.AppRelativeTemplateSourceDirectory;//"~/Modules/AspxCommerce/AspxLatestItems/";
            hst = AppLocalized.getLocale(modulePath);
            string pageExtension          = SageFrameSettingKeys.PageExtension;
            string aspxTemplateFolderPath = resolveUrl + "Templates/" + TemplateName;
            string aspxRootPath           = resolveUrl;

            DataTable dtItems = ds.Tables[1];

            if (dtItems != null && dtItems.Rows.Count > 0)
            {
                for (int i = 0; i < dtItems.Rows.Count; i++)
                {
                    string imagePath    = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + dtItems.Rows[i]["ImagePath"];
                    string altImagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + dtItems.Rows[i]["AlternateImagePath"];
                    if (dtItems.Rows[i]["ImagePath"].ToString() == string.Empty)
                    {
                        imagePath = DefaultImagePath;
                    }
                    else
                    {   //Resize Image Dynamically
                        InterceptImageController.ImageBuilder(dtItems.Rows[i]["ImagePath"].ToString(), ImageType.Medium, ImageCategoryType.Item, aspxCommonObj);
                    }
                    if (dtItems.Rows[i]["AlternateText"].ToString() == string.Empty)
                    {
                        dtItems.Rows[i]["AlternateText"] = dtItems.Rows[i]["Name"];
                    }
                    if (dtItems.Rows[i]["AlternateImagePath"].ToString() == string.Empty)
                    {
                        altImagePath = imagePath;
                    }
                    string itemPrice      = Convert.ToDecimal(dtItems.Rows[i]["Price"]).ToString("N2");
                    string itemPriceValue = dtItems.Rows[i]["Price"].ToString();
                    string itemPriceRate  = Convert.ToDecimal(dtItems.Rows[i]["Price"]).ToString("N2");

                    if ((i + 1) % NoOfLatestItemsInARow == 0)
                    {
                        RecentItemContents.Append("<div class=\"cssClassProductsBox cssClassNoMargin\">");
                    }
                    else
                    {
                        RecentItemContents.Append("<div class=\"cssClassProductsBox\">");
                    }
                    var hrefItem = aspxRedirectPath + "item/" + fixedEncodeURIComponent(dtItems.Rows[i]["SKU"].ToString()) + pageExtension;//dt.rows[i]["SKU"].tos();
                    RecentItemContents.Append("<div id=\"productImageWrapID_");
                    RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                    RecentItemContents.Append("\" class=\"cssClassProductsBoxInfo\" costvariantItem=");
                    RecentItemContents.Append(dtItems.Rows[i]["IsCostVariantItem"]);
                    RecentItemContents.Append("  itemid=\"");
                    RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                    RecentItemContents.Append("\">");
                    RecentItemContents.Append("<h3>");
                    RecentItemContents.Append(dtItems.Rows[i]["SKU"]);
                    RecentItemContents.Append("</h3><div><div class=\"divitemImage cssClassProductPicture\"><a href=\"");
                    RecentItemContents.Append(hrefItem);
                    RecentItemContents.Append("\" ><img id=\"img_");
                    RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                    RecentItemContents.Append("\"  alt=\"");
                    RecentItemContents.Append(dtItems.Rows[i]["AlternateText"]);
                    RecentItemContents.Append("\"  title=\"");
                    RecentItemContents.Append(dtItems.Rows[i]["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("\"/></a></div>");
                    RecentItemContents.Append("<div class='cssLatestItemInfo clearfix'>");
                    RecentItemContents.Append("<h2><a href=\"");
                    RecentItemContents.Append(hrefItem);
                    RecentItemContents.Append("\" title=\"");
                    RecentItemContents.Append(dtItems.Rows[i]["Name"]);
                    RecentItemContents.Append("\">");
                    string name = string.Empty;
                    if (dtItems.Rows[i]["Name"].ToString().Length > 50)
                    {
                        name = dtItems.Rows[i]["Name"].ToString().Substring(0, 50);
                        int index = 0;
                        index = name.LastIndexOf(' ');
                        name  = name.Substring(0, index);
                        name  = name + "...";
                    }
                    else
                    {
                        name = dtItems.Rows[i]["Name"].ToString();
                    }
                    RecentItemContents.Append(name);
                    RecentItemContents.Append("</a></h2>");
                    if (bool.Parse(dtItems.Rows[i]["HidePrice"].ToString()) != true)
                    {
                        if (dtItems.Rows[i]["ListPrice"] != null && dtItems.Rows[i]["ListPrice"].ToString() != string.Empty)
                        {
                            if ((int)dtItems.Rows[i]["ItemTypeID"] == 5)
                            {
                                RecentItemContents.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                                RecentItemContents.Append("<p class=\"cssClassProductRealPrice \">");
                                RecentItemContents.Append(getLocale("Starting At "));
                                RecentItemContents.Append("<span class=\"cssClassFormatCurrency\">");
                                RecentItemContents.Append(itemPriceRate);
                                RecentItemContents.Append("</span></p></div></div>");
                            }
                            else
                            {
                                string strAmount = Convert.ToDecimal((dtItems.Rows[i]["ListPrice"])).ToString("N2");
                                RecentItemContents.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                                RecentItemContents.Append("<p class=\"cssClassProductOffPrice\">");
                                RecentItemContents.Append("<span class=\"cssClassFormatCurrency\">");
                                RecentItemContents.Append(strAmount);
                                RecentItemContents.Append("</span></p><p class=\"cssClassProductRealPrice \">");
                                RecentItemContents.Append("<span class=\"cssClassFormatCurrency\">");
                                RecentItemContents.Append(itemPriceRate);
                                RecentItemContents.Append("</span></p></div></div>");
                            }
                        }
                        else
                        {
                            if ((int)dtItems.Rows[i]["ItemTypeID"] == 5)
                            {
                                RecentItemContents.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                                RecentItemContents.Append("<p class=\"cssClassProductRealPrice \">");
                                RecentItemContents.Append(getLocale("Starting At "));
                                RecentItemContents.Append("<span class=\"cssClassFormatCurrency\">");
                                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("<span class=\"cssClassFormatCurrency\">");
                                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(dtItems.Rows[i]["SKU"]);
                    RecentItemContents.Append(pageExtension);
                    RecentItemContents.Append("\">");
                    RecentItemContents.Append(getLocale("Details"));
                    RecentItemContents.Append("</a></p></div>");
                    if (dtItems.Rows[i]["AttributeValues"] != null)
                    {
                        if (dtItems.Rows[i]["AttributeValues"].ToString() != string.Empty)
                        {
                            RecentItemContents.Append("<div class=\"cssGridDyanamicAttr\">");
                            string[] attributeValues = dtItems.Rows[i]["AttributeValues"].ToString().Split(',');
                            foreach (string element in attributeValues)
                            {
                                string[] attributes     = element.Split('#');
                                string   attributeName  = attributes[0];
                                string   attributeValue = attributes[1];
                                int      inputType      = Int32.Parse(attributes[2]);
                                string   validationType = attributes[3];
                                RecentItemContents.Append("<div class=\"cssDynamicAttributes\">");
                                RecentItemContents.Append("<span>");
                                RecentItemContents.Append(attributeName);
                                RecentItemContents.Append("</span> :");
                                if (inputType == 7)
                                {
                                    RecentItemContents.Append("<span class=\"cssClassFormatCurrency\">");
                                }
                                else
                                {
                                    RecentItemContents.Append("<span>");
                                }
                                RecentItemContents.Append(attributeValue);
                                RecentItemContents.Append("</span></div>");
                            }
                            RecentItemContents.Append("</div>");
                        }
                    }
                    string        itemSKU     = dtItems.Rows[i]["SKU"].ToString();
                    string        itemName    = dtItems.Rows[i]["Name"].ToString();
                    StringBuilder dataContent = new StringBuilder();
                    dataContent.Append("data-class=\"addtoCart\" data-type=\"button\" data-addtocart=\"");
                    dataContent.Append("addtocart");
                    dataContent.Append(dtItems.Rows[i]["ItemID"]);
                    dataContent.Append("\" data-title=\"");
                    dataContent.Append(itemName);
                    dataContent.Append("\" data-onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                    dataContent.Append(dtItems.Rows[i]["ItemID"]);
                    dataContent.Append(",");
                    dataContent.Append(itemPriceValue);
                    dataContent.Append(",'");
                    dataContent.Append(itemSKU);
                    dataContent.Append("',");
                    dataContent.Append(1);
                    dataContent.Append(",'");
                    dataContent.Append(dtItems.Rows[i]["IsCostVariantItem"]);
                    dataContent.Append("',this);\"");
                    RecentItemContents.Append("<div class=\"cssClassTMar20 clearfix\">");
                    if (AllowAddToCart.ToLower() == "true")
                    {
                        if (AllowOutStockPurchase.ToLower() == "false")
                        {
                            if (bool.Parse(dtItems.Rows[i]["IsOutOfStock"].ToString()) == true)
                            {
                                RecentItemContents.Append("<div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper cssClassOutOfStock\"  data-ItemTypeID=\"");
                                RecentItemContents.Append(dtItems.Rows[i]["ItemTypeID"]);
                                RecentItemContents.Append("\" data-ItemID=\"");
                                RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                                RecentItemContents.Append("\" ");
                                RecentItemContents.Append(dataContent);
                                RecentItemContents.Append(">");
                                RecentItemContents.Append("<button type=\"button\"><span>");
                                RecentItemContents.Append(getLocale("Out Of Stock"));
                                RecentItemContents.Append("</span></button></div></div>");
                            }
                            else
                            {
                                RecentItemContents.Append("<div class=\"cssClassAddtoCard\"><div data-ItemTypeID=\"");
                                RecentItemContents.Append(dtItems.Rows[i]["ItemTypeID"]);
                                RecentItemContents.Append("\" data-ItemID=\"");
                                RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                                RecentItemContents.Append("\" ");
                                RecentItemContents.Append(dataContent);
                                RecentItemContents.Append(" class=\"sfButtonwrapper\">");
                                RecentItemContents.Append("<label class='i-cart cssClassCartLabel cssClassGreenBtn'><button type=\"button\" class=\"addtoCart\"");
                                RecentItemContents.Append("addtocart=\"");
                                RecentItemContents.Append("addtocart");
                                RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                                RecentItemContents.Append("\" title=\"");
                                RecentItemContents.Append(itemName);
                                RecentItemContents.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                                RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                                RecentItemContents.Append(",");
                                RecentItemContents.Append(itemPriceValue);
                                RecentItemContents.Append(",'");
                                RecentItemContents.Append(itemSKU);
                                RecentItemContents.Append("',");
                                RecentItemContents.Append(1);
                                RecentItemContents.Append(",'");
                                RecentItemContents.Append(dtItems.Rows[i]["IsCostVariantItem"]);
                                RecentItemContents.Append("',this);\">");
                                RecentItemContents.Append(getLocale("Cart +"));
                                RecentItemContents.Append("</button></label></div></div>");
                            }
                        }
                        else
                        {
                            RecentItemContents.Append("<div class=\"cssClassAddtoCard\"><div data-ItemTypeID=\"");
                            RecentItemContents.Append(dtItems.Rows[i]["ItemTypeID"]);
                            RecentItemContents.Append("\" data-ItemID=\"");
                            RecentItemContents.Append(dtItems.Rows[i]["ItemID "]);
                            RecentItemContents.Append("\"");
                            RecentItemContents.Append(dataContent);
                            RecentItemContents.Append(" class=\"sfButtonwrapper\">");
                            RecentItemContents.Append("<label class='i-cart cssClassCartLabel cssClassGreenBtn'><button type=\"button\" class=\"addtoCart\"");
                            RecentItemContents.Append("addtocart=\"");
                            RecentItemContents.Append("addtocart");
                            RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                            RecentItemContents.Append("\" title=\"");
                            RecentItemContents.Append(itemName);
                            RecentItemContents.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                            RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                            RecentItemContents.Append(",");
                            RecentItemContents.Append(itemPriceValue);
                            RecentItemContents.Append(",'");
                            RecentItemContents.Append(itemSKU);
                            RecentItemContents.Append("',");
                            RecentItemContents.Append(1);
                            RecentItemContents.Append(",'");
                            RecentItemContents.Append(dtItems.Rows[i]["IsCostVariantItem"]);
                            RecentItemContents.Append("',this);\">");
                            RecentItemContents.Append(getLocale("Cart +"));
                            RecentItemContents.Append("</button></label></div></div>");
                        }
                    }
                    if (GetCustomerID > 0 && GetUsername.ToLower() != "anonymoususer")
                    {
                        RecentItemContents.Append("<div class=\"cssClassWishListButton\">");
                        RecentItemContents.Append("<label class='i-wishlist cssWishListLabel cssClassDarkBtn'><button type=\"button\" id=\"addWishList\" onclick=AspxCommerce.RootFunction.CheckWishListUniqueness(");
                        RecentItemContents.Append(dtItems.Rows[i]["ItemID"]);
                        RecentItemContents.Append(",'");
                        RecentItemContents.Append(dtItems.Rows[i]["SKU"]);
                        RecentItemContents.Append("',this);><span>");
                        RecentItemContents.Append(getLocale("Wishlist+"));
                        RecentItemContents.Append("</span></button></label></div>");
                    }
                    else
                    {
                        RecentItemContents.Append("<div class=\"cssClassWishListButton\">");
                        RecentItemContents.Append("<label class='i-wishlist cssWishListLabel cssClassDarkBtn'><button type=\"button\" id=\"addWishList\" onclick=\"AspxCommerce.RootFunction.Login();\">");
                        RecentItemContents.Append("<span>");
                        RecentItemContents.Append(getLocale("Wishlist+"));
                        RecentItemContents.Append("</span></button></label></div>");
                    }

                    RecentItemContents.Append("</div></div>");
                    RecentItemContents.Append("</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();
        }
    }
    public void GetShoppingFilterItemsResult(AspxCommonInfo aspxCommonObj)
    {
        StringBuilder        strItemsResult  = new StringBuilder();
        JavaScriptSerializer json_serializer = new JavaScriptSerializer();
        string template      = AspxGetTemplates.GetAspxTemplate(ViewAsOptionsDefault);
        string itemImagePath = ResolveUrl("~/") + "Modules/AspxCommerce/AspxItemsManagement/uploads/";
        List <ItemBasicDetailsInfo> lstItems = AspxFilterController.GetShoppingFilterItemsResult(1, 9, "", "", minPrice, maxPrice, Categorykey, false, SortByOptionsDefault, aspxCommonObj);

        if (lstItems != null && lstItems.Count > 0)
        {
            if (ViewAsOptionsDefault == 1)
            {
                strItemsResult.Append("<div class='cssCatProductGridWrapper'>");
            }
            Page.ClientScript.RegisterArrayDeclaration("arrItemsOptionToBind", json_serializer.Serialize(lstItems));
            string price     = "0.00";
            string listPrice = "0.00";
            foreach (ItemBasicDetailsInfo value in lstItems)
            {
                string template1 = template;
                string imagePath = itemImagePath + value.BaseImage;
                if (value.BaseImage == string.Empty)
                {
                    imagePath = NoImageCategoryDetailPath;
                }
                else
                {
                    InterceptImageController.ImageBuilder(value.BaseImage, ImageType.Medium, ImageCategoryType.Item, aspxCommonObj);
                }
                string name = string.Empty;
                if (value.Name.Length > 50)
                {
                    name = value.Name.Substring(0, 50);
                    var i = 0;
                    i    = name.LastIndexOf(' ');
                    name = name.Substring(0, i);
                    name = name + "...";
                }
                else
                {
                    name = value.Name;
                }
                string sku = json_serializer.Serialize(value.SKU);

                string title = json_serializer.Serialize(value.Name);
                price     = (!string.IsNullOrEmpty(value.Price) ? Convert.ToDecimal(value.Price).ToString("N2") : "0.00");
                listPrice = (!string.IsNullOrEmpty(value.ListPrice) ? Convert.ToDecimal(value.ListPrice).ToString("N2") : "0.00");
                Dictionary <string, string> replacements = new Dictionary <string, string>();
                replacements.Add("${sku}", value.SKU);
                replacements.Add("${aspxRedirectPath}", aspxRedirectPath);
                replacements.Add("${pageExtension}", SageFrameSettingKeys.PageExtension);
                replacements.Add("${imagePath}", imagePath);
                replacements.Add("${alternateText}", value.AlternateText);
                replacements.Add("${name}", name);
                replacements.Add("${titleName}", title);
                replacements.Add("${parseFloat(price).toFixed(2)}", price);
                replacements.Add("${JSON2.stringify(sku)}", sku);
                replacements.Add("${isCostVariant}", json_serializer.Serialize(value.IsCostVariantItem.ToString()));
                replacements.Add("${1}", "1");
                replacements.Add("${price}", value.Price);
                if (value.ListPrice != string.Empty)
                {
                    replacements.Add("${parseFloat(listPrice).toFixed(2)}", listPrice);
                }
                else
                {
                    replacements.Add("<p class=\"cssClassProductOffPrice\">", string.Empty);
                    replacements.Add("<span class=\"cssRegularPrice_${itemID} cssClassFormatCurrency\">${parseFloat(listPrice).toFixed(2)}</span></p>", string.Empty);
                }
                // Replace
                if (value.AttributeValues != null)
                {
                    if (value.AttributeValues != string.Empty)
                    {
                        string   attrHtml   = string.Empty;
                        string[] attrValues = value.AttributeValues.Split(',');
                        for (var i = 0; i < attrValues.Length; i++)
                        {
                            string[] attributes     = attrValues[i].Split('#');
                            string   attributeName  = attributes[0];
                            string   attributeValue = attributes[1];
                            int      inputType      = Int32.Parse(attributes[2]);
                            string   validationType = attributes[3];
                            attrHtml += "<div class=\"cssDynamicAttributes\">";
                            if (inputType == 7)
                            {
                                attrHtml += "<span class=\"cssClassFormatCurrency\">";
                            }
                            else
                            {
                                attrHtml += "<span>";
                            }
                            attrHtml += attributeValue;
                            attrHtml += "</span></div>";
                        }
                        replacements.Add("$DynamicAttr", attrHtml);
                    }
                    else
                    {
                        if (ViewAsOptionsDefault == 1)
                        {
                            replacements.Add("<div class=\"cssGridDyanamicAttr\">$DynamicAttr</div>", string.Empty);
                        }
                        else
                        {
                            replacements.Add("<div class=\"cssListDyanamicAttr\">$DynamicAttr</div>", string.Empty);
                        }
                    }
                }
                else
                {
                    if (ViewAsOptionsDefault == 1)
                    {
                        replacements.Add("<div class=\"cssGridDyanamicAttr\">$DynamicAttr</div>", string.Empty);
                    }
                    else
                    {
                        replacements.Add("<div class=\"cssListDyanamicAttr\">$DynamicAttr</div>", string.Empty);
                    }
                }

                if (AllowAddToCart.ToLower() == "true")
                {
                    if (AllowOutStockPurchase.ToLower() == "false")
                    {
                        if ((bool)value.IsOutOfStock)
                        {
                            replacements.Add("<span class=\"sfLocale\">" + getLocale("Cart +") + "</span>", "<span class=\"sfLocale\">" + getLocale("Out Of Stock") + "</span>");
                            replacements.Add("<div class=\"cssClassAddtoCard_${itemID} cssClassAddtoCard\">", "<div class=\"cssClassAddtoCard_${itemID} cssClassOutOfStock\">");
                            replacements.Add("<label class=\"i-cart cssClassCartLabel cssClassGreenBtn\">", "<label class=\"cssClassCartLabel\">");
                            replacements.Add("onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(${itemID},${price},${JSON2.stringify(sku)},${1},${isCostVariant},this);", string.Empty);
                        }
                    }
                }
                else
                {
                    replacements.Add("<div class=\"cssClassAddtoCard_${itemID} cssClassAddtoCard\">", "<div class=\"cssClassAddtoCard_${itemID} cssClassAddtoCard\" style=\"display: none;\">");
                }
                if (value.ItemTypeID == 5)
                {
                    replacements.Add("<p class=\"cssClassProductRealPrice\">", "<p class=\"cssClassProductRealPrice\">" + getLocale("Starting At") + "");
                }
                if (ViewAsOptionsDefault == 2)
                {
                    replacements.Add("{{html shortDescription}}", Server.HtmlDecode(value.ShortDescription));
                }

                replacements.Add("${itemID}", value.ItemID.ToString());
                foreach (var replacement in replacements)
                {
                    template1 = template1.Replace(replacement.Key, replacement.Value);
                }
                strItemsResult.Append(template1);
            }
            if (ViewAsOptionsDefault == 1)
            {
                strItemsResult.Append("</div>");
                StringBuilder strScriptExecute = new StringBuilder();
                strScriptExecute.Append("var $container");
                strScriptExecute.Append("= ");
                strScriptExecute.Append("$('.cssCatProductGridWrapper');");
                strScriptExecute.Append("$container.imagesLoaded(function () {");
                strScriptExecute.Append("$container.masonry({");
                strScriptExecute.Append("itemSelector: '.cssClassProductsBox',");
                strScriptExecute.Append("EnableSorting: false");
                strScriptExecute.Append("});");
                strScriptExecute.Append("});");
                string script = GetStringScript(strScriptExecute.ToString());
                strItemsResult.Append(script);
            }

            ltrCategoryItems.Text = strItemsResult.ToString();
            CreateDropdownPageSize(lstItems.Count);
        }
        else
        {
            ltrCategoryItems.Text = ("<span class=\"cssClassNotFound\">" + getLocale("No items found or matched!") + "</span>").ToString();
        }
    }
    public void GetItemRelatedUpSellAndCrossSellList(string itemsku)
    {
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

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

        hst = AppLocalized.getLocale(modulePath);
        string pageExtension = SageFrameSettingKeys.PageExtension;
        List <ItemBasicDetailsInfo> lstRelatedItem = AspxRelatedItemController.GetYouMayAlsoLikeItems(itemsku, aspxCommonObj, NoOfYouMayAlsoLikeItems);
        StringBuilder realatedItemCartContent      = new StringBuilder();

        if (lstRelatedItem != null && lstRelatedItem.Count > 0)
        {
            realatedItemCartContent.Append("<div class=\"cssClassSpecialBoxInfo\" id=\"divSpItem\">");
            realatedItemCartContent.Append("<ul>");
            for (int index = 0; index < lstRelatedItem.Count; index++)
            {
                string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + lstRelatedItem[index].BaseImage;
                if (lstRelatedItem[index].BaseImage == null || lstRelatedItem[index].BaseImage == "")
                {
                    imagePath = NoImageYouMayAlsoLikePath;
                }

                if (lstRelatedItem[index].AlternateText == "")
                {
                    lstRelatedItem[index].AlternateText = lstRelatedItem[index].Name;
                }

                if ((index + 1) % 4 == 0)
                {
                    realatedItemCartContent.Append("<div class=\"cssClassYouMayAlsoLikeBox cssClassYouMayAlsoLikeBoxFourth\">");
                }
                else
                {
                    realatedItemCartContent.Append("<div class=\"cssClassYouMayAlsoLikeBox\">");
                }
                realatedItemCartContent.Append("<p class=\"cssClassCartPicture\"><a href=\"");
                realatedItemCartContent.Append(aspxRedirectPath);
                realatedItemCartContent.Append("item/");
                realatedItemCartContent.Append(lstRelatedItem[index].SKU + pageExtension);
                realatedItemCartContent.Append("\"><img alt=\"");
                realatedItemCartContent.Append(lstRelatedItem[index].AlternateText);
                realatedItemCartContent.Append("\" title=\"");
                realatedItemCartContent.Append(lstRelatedItem[index].Name);
                realatedItemCartContent.Append("\" src=\"");
                realatedItemCartContent.Append(aspxRootPath + imagePath.Replace("uploads", "uploads/Medium"));
                realatedItemCartContent.Append("\"></a></p>");
                realatedItemCartContent.Append("<p class=\"cssClassProductRealPrice\"><span class=\"cssClassFormatCurrency\">Price : ");
                realatedItemCartContent.Append(Convert.ToDecimal(lstRelatedItem[index].Price) * Rate);
                realatedItemCartContent.Append("</span></p>");

                if (AllowOutStockPurchase.ToLower() == "false")
                {
                    if ((bool)lstRelatedItem[index].IsOutOfStock)
                    {
                        realatedItemCartContent.Append("<div class=\"sfButtonwrapper cssClassOutOfStock\"><a href=\"#\"><span>");
                        realatedItemCartContent.Append(getLocale("Out Of Stock"));
                        realatedItemCartContent.Append("</span></a></div></div>");
                    }
                    else
                    {
                        realatedItemCartContent.Append("<div class=\"sfButtonwrapper\"><a href=\"#\" onclick=\"YouMayAlsoLike.AddToCartToJS(");
                        realatedItemCartContent.Append(lstRelatedItem[index].ItemID + ",");
                        realatedItemCartContent.Append(lstRelatedItem[index].Price + ",");
                        realatedItemCartContent.Append("'" + lstRelatedItem[index].SKU + "'," + 1);
                        realatedItemCartContent.Append(");\"><span>");
                        realatedItemCartContent.Append(getLocale("Add to Cart"));
                        realatedItemCartContent.Append("</span></a></div></div>");
                    }
                }
                else
                {
                    realatedItemCartContent.Append("<div class=\"sfButtonwrapper\"><a href=\"#\" onclick=\"YouMayAlsoLike.AddToCartToJS(");
                    realatedItemCartContent.Append(lstRelatedItem[index].ItemID + ",");
                    realatedItemCartContent.Append(lstRelatedItem[index].Price + ",");
                    realatedItemCartContent.Append("'" + lstRelatedItem[index].SKU + "'," + 1);
                    realatedItemCartContent.Append(");\"><span>");
                    realatedItemCartContent.Append(getLocale("Add to Cart"));
                    realatedItemCartContent.Append("</span></a></div></div>");
                }
            }
            realatedItemCartContent.Append("<div class=\"cssClassClear\"></div>");
        }

        else
        {
            realatedItemCartContent.Append("<span class=\"cssClassNotFound\">");
            realatedItemCartContent.Append(getLocale("No Data found."));
            realatedItemCartContent.Append("</span>");
        }
        ltrRelatedItemInCart.Text = realatedItemCartContent.ToString();
    }
예제 #13
0
    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();
        }
    }
예제 #14
0
    public void GetAllGiftCards()
    {
        AspxCommonInfo aspxCommonObj = new AspxCommonInfo();

        aspxCommonObj.StoreID     = StoreID;
        aspxCommonObj.PortalID    = PortalID;
        aspxCommonObj.UserName    = UserName;
        aspxCommonObj.CultureName = CultureName;
        int offset = 1;
        int limit  = 8;
        List <LatestItemsInfo> lstGiftItems = AspxItemMgntController.GetAllGiftCards(offset, limit, rowTotal, 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("~/");

        if (lstGiftItems != null && lstGiftItems.Count > 0)
        {
            foreach (LatestItemsInfo item in lstGiftItems)
            {
                rowTotal = item.RowTotal;
                string imagePath = "Modules/AspxCommerce/AspxItemsManagement/uploads/" + item.ImagePath;
                if (item.ImagePath == "")
                {
                    item.ImagePath = DefaultImagePath;
                }
                if (item.AlternateText == "")
                {
                    item.AlternateText = item.Name;
                }
                if ((lstGiftItems.IndexOf(item) + 1) % NoOfItemsInARow == 0)
                {
                    GiftItems.Append("<div class=\"cssClassProductsBox cssClassNoMargin\">");
                }
                else
                {
                    GiftItems.Append("<div class=\"cssClassProductsBox\">");
                }
                string itemPrice     = Convert.ToDecimal(item.Price).ToString("N2");
                string itemPriceRate = Convert.ToDecimal(item.Price).ToString("N2");

                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), 2).ToString();
                        GiftItems.Append("<div class=\"cssClassProductPriceBox\"><div class=\"cssClassProductPrice\">");
                        GiftItems.Append("<p class=\"cssClassProductOffPrice\">");
                        GiftItems.Append("<span class=\"cssClassFormatCurrency\" value=");
                        GiftItems.Append(Convert.ToDecimal(item.ListPrice).ToString("N2"));
                        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 (GetCustomerID > 0 && GetUsername.ToLower() != "anonymoususer")
                {
                    GiftItems.Append("<div class=\"cssClassWishListButton\">");
                    GiftItems.Append("<input type=\"hidden\" name='itemwish' value=");
                    GiftItems.Append(item.ItemID);
                    GiftItems.Append(",'");
                    GiftItems.Append(item.SKU);
                    GiftItems.Append("',this  />");
                    GiftItems.Append("</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>");
                }
                GiftItems.Append("<div class=\"cssClassCompareButton\">");
                GiftItems.Append("<input type=\"hidden\" name='itemcompare' value=");
                GiftItems.Append(item.ItemID);
                GiftItems.Append(",'");
                GiftItems.Append(item.SKU);
                GiftItems.Append("',this  />");
                GiftItems.Append(" </div>");

                GiftItems.Append("</div>");
                GiftItems.Append("<div class=\"cssClassclear\"></div></div>");
                string itemSKU  = item.SKU;
                string itemName = item.Name;
                if (AllowAddToCart.ToLower() == "true")
                {
                    if (AllowOutStockPurchase.ToLower() == "false")
                    {
                        if (item.IsOutOfStock == true)
                        {
                            GiftItems.Append(
                                "<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 class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\">");
                            GiftItems.Append("<button type=\"button\" class=\"addtoCart\"");
                            GiftItems.Append("data-addtocart=\"");
                            GiftItems.Append("addtocart");
                            GiftItems.Append(item.ItemID);
                            GiftItems.Append("\" title=\"");
                            GiftItems.Append(item.Name);

                            GiftItems.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                            GiftItems.Append(item.ItemID + ",");
                            GiftItems.Append(item.Price + ",");
                            GiftItems.Append("'" + item.SKU + "'" + "," + 1);
                            GiftItems.Append(",'");
                            GiftItems.Append(item.IsCostVariantItem);
                            GiftItems.Append("',this);\"><span>");
                            GiftItems.Append(getLocale("Add To Cart"));
                            GiftItems.Append("</span></button></div></div>");
                        }
                    }
                    else
                    {
                        GiftItems.Append("<div class=\"cssClassAddtoCard\"><div class=\"sfButtonwrapper\">");
                        GiftItems.Append("<button type=\"button\" class=\"addtoCart\"");
                        GiftItems.Append("data-addtocart=\"");
                        GiftItems.Append("addtocart");
                        GiftItems.Append(item.ItemID);
                        GiftItems.Append("\" title=\"");
                        GiftItems.Append(item.Name);

                        GiftItems.Append("\" onclick=\"AspxCommerce.RootFunction.AddToCartFromJS(");
                        GiftItems.Append(item.ItemID + ",");
                        GiftItems.Append(item.Price + ",");
                        GiftItems.Append("'" + item.SKU + "'" + "," + 1);
                        GiftItems.Append(",'");
                        GiftItems.Append(item.IsCostVariantItem);
                        GiftItems.Append("',this);\"><span>");
                        GiftItems.Append(getLocale("Add To Cart"));
                        GiftItems.Append("</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();
    }