protected void dlAlsoPurchasedProducts_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                Product product = e.Item.DataItem as Product;
                if (product != null)
                {
                    string productURL = SEOHelper.GetProductURL(product);

                    HyperLink hlImageLink = e.Item.FindControl("hlImageLink") as HyperLink;
                    if (hlImageLink != null)
                    {
                        ProductPictureCollection productPictures = product.ProductPictures;
                        if (productPictures.Count > 0)
                        {
                            hlImageLink.ImageUrl = PictureManager.GetPictureUrl(productPictures[0].Picture, SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125), true);
                        }
                        else
                        {
                            hlImageLink.ImageUrl = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125));
                        }
                        hlImageLink.NavigateUrl = productURL;
                        hlImageLink.ToolTip     = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                        hlImageLink.Text        = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                    }

                    HyperLink hlProduct = e.Item.FindControl("hlProduct") as HyperLink;
                    if (hlProduct != null)
                    {
                        hlProduct.NavigateUrl = productURL;
                        hlProduct.Text        = product.Name;
                    }
                }
            }
        }
        protected void BindProductInfo(Product product)
        {
            lProductName.Text = Server.HtmlEncode(product.Name);
            // lProductName1.Text = Server.HtmlEncode(product.Name);
            lShortDescription.Text = product.ShortDescription;
            lFullDescription.Text  = product.FullDescription;

            var productPictures = product.ProductPictures;

            if (productPictures.Count > 1)
            {
                defaultImage.ImageUrl        = PictureManager.GetPictureUrl(productPictures[0].PictureId, SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                defaultImage.ToolTip         = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                defaultImage.AlternateText   = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                lvProductPictures.DataSource = productPictures;
                lvProductPictures.DataBind();
            }
            else if (productPictures.Count == 1)
            {
                defaultImage.ImageUrl      = PictureManager.GetPictureUrl(productPictures[0].PictureId, SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                defaultImage.ToolTip       = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                lvProductPictures.Visible  = false;
            }
            else
            {
                defaultImage.ImageUrl      = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                defaultImage.ToolTip       = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                lvProductPictures.Visible  = false;
            }
        }
示例#3
0
        public string GetProductVariantImageUrl(ShoppingCartItem shoppingCartItem)
        {
            string pictureUrl     = String.Empty;
            var    productVariant = shoppingCartItem.ProductVariant;

            if (productVariant != null)
            {
                var productVariantPicture = productVariant.Picture;
                pictureUrl = PictureManager.GetPictureUrl(productVariantPicture, SettingManager.GetSettingValueInteger("Media.ShoppingCart.ThumbnailImageSize", 80), false);
                if (String.IsNullOrEmpty(pictureUrl))
                {
                    var            product        = productVariant.Product;
                    ProductPicture productPicture = product.DefaultProductPicture;
                    if (productPicture != null)
                    {
                        pictureUrl = PictureManager.GetPictureUrl(productPicture.Picture, SettingManager.GetSettingValueInteger("Media.ShoppingCart.ThumbnailImageSize", 80));
                    }
                    else
                    {
                        pictureUrl = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.ShoppingCart.ThumbnailImageSize", 80));
                    }
                }
            }
            return(pictureUrl);
        }
示例#4
0
        private void BindData()
        {
            if (product != null)
            {
                string productURL = SEOHelper.GetProductUrl(product);

                hlProduct.NavigateUrl = productURL;
                hlProduct.Text        = Server.HtmlEncode(product.LocalizedName);

                var picture = product.DefaultPicture;
                if (picture != null)
                {
                    hlImageLink.ImageUrl = PictureManager.GetPictureUrl(picture, this.ProductImageSize, true);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.LocalizedName);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                }
                else
                {
                    hlImageLink.ImageUrl = PictureManager.GetDefaultPictureUrl(this.ProductImageSize);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.LocalizedName);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                }

                hlImageLink.NavigateUrl = productURL;
                lShortDescription.Text  = product.LocalizedShortDescription;

                var productVariantCollection = product.ProductVariants;
                if (productVariantCollection.Count > 0)
                {
                    if (!product.HasMultipleVariants)
                    {
                        var productVariant = productVariantCollection[0];
                        btnAddToCart.Visible = (!productVariant.DisableBuyButton);
                        if (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                            (NopContext.Current.User != null &&
                             !NopContext.Current.User.IsGuest))
                        {
                            //nothing
                        }
                        else
                        {
                            btnAddToCart.Visible = false;
                        }
                    }
                    else
                    {
                        btnAddToCart.Visible = false;
                    }
                }
                else
                {
                    btnAddToCart.Visible = false;
                }
            }
        }
示例#5
0
        public string GetProductImageUrl(Product product)
        {
            var picture = product.DefaultPicture;

            if (picture != null)
            {
                return(PictureManager.GetPictureUrl(picture, SettingManager.GetSettingValueInteger("Media.ShoppingCart.ThumbnailImageSize", 80)));
            }
            else
            {
                return(PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.ShoppingCart.ThumbnailImageSize", 80)));
            }
        }
示例#6
0
        private void BindData()
        {
            pnlCustomerAvatarError.Visible = false;

            var    customerAvatar = NopContext.Current.User.Avatar;
            int    avatarSize     = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
            string pictureUrl     = string.Empty;

            if (customerAvatar != null)
            {
                pictureUrl = PictureManager.GetPictureUrl(customerAvatar, avatarSize, false);
                this.btnRemoveAvatar.Visible = true;
            }
            else
            {
                pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                this.btnRemoveAvatar.Visible = false;
            }
            this.iAvatar.ImageUrl = pictureUrl;
        }
示例#7
0
        private void BindData()
        {
            Customer customer = CustomerManager.GetCustomerById(this.CustomerId);

            if (customer != null)
            {
                var    customerAvatar = customer.Avatar;
                int    avatarSize     = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                string pictureUrl     = string.Empty;
                if (customerAvatar != null)
                {
                    pictureUrl = PictureManager.GetPictureUrl(customerAvatar, avatarSize, false);
                    this.btnRemoveAvatar.Visible = true;
                }
                else
                {
                    pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                    this.btnRemoveAvatar.Visible = false;
                }
                this.imgAvatar.ImageUrl = pictureUrl;
            }
        }
        private void BindData()
        {
            if (product != null)
            {
                string productURL = SEOHelper.GetProductURL(product);

                ProductPictureCollection productPictures = product.ProductPictures;
                if (productPictures.Count > 0)
                {
                    hlImageLink.ImageUrl = PictureManager.GetPictureUrl(productPictures[0].Picture, ProductImageSize, true);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                }
                else
                {
                    hlImageLink.ImageUrl = PictureManager.GetDefaultPictureUrl(this.ProductImageSize);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                }
                hlImageLink.NavigateUrl = productURL;
            }
        }
示例#9
0
        protected void dlRelatedProducts_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var relatedProduct = e.Item.DataItem as RelatedProduct;
                var product        = relatedProduct.Product2;
                if (relatedProduct != null && product != null)
                {
                    string productURL = SEOHelper.GetProductUrl(product);

                    var hlImageLink = e.Item.FindControl("hlImageLink") as HyperLink;
                    if (hlImageLink != null)
                    {
                        ProductPicture productPicture = product.DefaultProductPicture;
                        if (productPicture != null)
                        {
                            hlImageLink.ImageUrl = PictureManager.GetPictureUrl(productPicture.Picture, SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125), true);
                        }
                        else
                        {
                            hlImageLink.ImageUrl = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125));
                        }
                        hlImageLink.NavigateUrl = productURL;
                        hlImageLink.ToolTip     = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                        hlImageLink.Text        = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                    }

                    var hlProduct = e.Item.FindControl("hlProduct") as HyperLink;
                    if (hlProduct != null)
                    {
                        hlProduct.NavigateUrl = productURL;
                        hlProduct.Text        = product.Name;
                    }
                }
            }
        }
示例#10
0
        public void CreateCompareTable()
        {
            this.tblCompareProducts.Rows.Clear();
            this.tblCompareProducts.Width = "100%";
            ProductCollection compareProducts = ProductManager.GetCompareProducts();

            if (compareProducts.Count > 0)
            {
                HtmlTableRow headerRow = new HtmlTableRow();
                this.AddCell(headerRow, " ");
                HtmlTableRow productNameRow = new HtmlTableRow();
                this.AddCell(productNameRow, " ");
                HtmlTableRow  priceRow = new HtmlTableRow();
                HtmlTableCell cell     = new HtmlTableCell();
                cell.InnerText = GetLocaleResourceString("Products.CompareProductsPrice");
                cell.Align     = "center";
                priceRow.Cells.Add(cell);

                List <int> allAttributeIDs = new List <int>();
                foreach (Product product in compareProducts)
                {
                    ProductSpecificationAttributeCollection productSpecificationAttributes = SpecificationAttributeManager.GetProductSpecificationAttributesByProductID(product.ProductID, null, true);
                    foreach (ProductSpecificationAttribute attribute in productSpecificationAttributes)
                    {
                        if (!allAttributeIDs.Contains(attribute.SpecificationAttributeOptionID))
                        {
                            allAttributeIDs.Add(attribute.SpecificationAttributeOptionID);
                        }
                    }
                }

                foreach (Product product in compareProducts)
                {
                    HtmlTableCell      headerCell        = new HtmlTableCell();
                    HtmlGenericControl headerCellDiv     = new HtmlGenericControl("div");
                    Button             btnRemoveFromList = new Button();
                    btnRemoveFromList.ToolTip          = GetLocaleResourceString("Products.CompareProductsRemoveFromList");
                    btnRemoveFromList.Text             = GetLocaleResourceString("Products.CompareProductsRemoveFromList");
                    btnRemoveFromList.CommandName      = "Remove";
                    btnRemoveFromList.Command         += new CommandEventHandler(this.btnRemoveFromList_Command);
                    btnRemoveFromList.CommandArgument  = product.ProductID.ToString();
                    btnRemoveFromList.CausesValidation = false;
                    btnRemoveFromList.CssClass         = "removeButton";
                    btnRemoveFromList.ID = "btnRemoveFromList" + product.ProductID.ToString();
                    headerCellDiv.Controls.Add(btnRemoveFromList);

                    HtmlGenericControl productImagePanel = new HtmlGenericControl("p");
                    productImagePanel.Attributes.Add("align", "center");

                    HtmlImage productImage = new HtmlImage();
                    productImage.Border = 0;
                    //productImage.Align = "center";
                    productImage.Alt = "Product image";
                    ProductPictureCollection productPictures = product.ProductPictures;
                    if (productPictures.Count > 0)
                    {
                        productImage.Src = PictureManager.GetPictureUrl(productPictures[0].Picture, SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125), true);
                    }
                    else
                    {
                        productImage.Src = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125));
                    }
                    productImagePanel.Controls.Add(productImage);

                    headerCellDiv.Controls.Add(productImagePanel);



                    headerCell.Controls.Add(headerCellDiv);
                    headerRow.Cells.Add(headerCell);
                    HtmlTableCell productNameCell = new HtmlTableCell();
                    HyperLink     productLink     = new HyperLink();
                    productLink.Text        = Server.HtmlEncode(product.Name);
                    productLink.NavigateUrl = SEOHelper.GetProductURL(product);
                    productLink.Attributes.Add("class", "link");
                    productNameCell.Align = "center";
                    productNameCell.Controls.Add(productLink);
                    productNameRow.Cells.Add(productNameCell);
                    HtmlTableCell priceCell = new HtmlTableCell();
                    priceCell.Align = "center";
                    ProductVariantCollection productVariantCollection = product.ProductVariants;
                    if (productVariantCollection.Count > 0)
                    {
                        ProductVariant productVariant = productVariantCollection[0];

                        //decimal oldPrice = productVariant.OldPrice;
                        //decimal oldPriceConverted = CurrencyManager.ConvertCurrency(oldPrice, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                        decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));
                        decimal finalPriceWithoutDiscount     = CurrencyManager.ConvertCurrency(finalPriceWithoutDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                        priceCell.InnerText = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                    }
                    priceRow.Cells.Add(priceCell);
                }
                productNameRow.Attributes.Add("class", "productName");
                priceRow.Attributes.Add("class", "productPrice");
                this.tblCompareProducts.Rows.Add(headerRow);
                this.tblCompareProducts.Rows.Add(productNameRow);
                this.tblCompareProducts.Rows.Add(priceRow);

                if (allAttributeIDs.Count > 0)
                {
                    foreach (int specificationAttributeID in allAttributeIDs)
                    {
                        //SpecificationAttribute attribute = SpecificationAttributeManager.GetSpecificationAttributeByID(specificationAttributeID);
                        SpecificationAttributeOption attributeOption = SpecificationAttributeManager.GetSpecificationAttributeOptionByID(specificationAttributeID);
                        HtmlTableRow productRow = new HtmlTableRow();
                        this.AddCell(productRow, Server.HtmlEncode(attributeOption.SpecificationAttribute.Name)).Align = "left";

                        foreach (Product product2 in compareProducts)
                        {
                            HtmlTableCell productCell = new HtmlTableCell();
                            {
                                ProductSpecificationAttributeCollection productSpecificationAttributes2 = SpecificationAttributeManager.GetProductSpecificationAttributesByProductID(product2.ProductID, null, true);
                                foreach (ProductSpecificationAttribute attribute2 in productSpecificationAttributes2)
                                {
                                    if (attributeOption.SpecificationAttributeOptionID == attribute2.SpecificationAttributeOptionID)
                                    {
                                        productCell.InnerHtml = (!String.IsNullOrEmpty(attribute2.SpecificationAttributeOption.Name)) ? Server.HtmlEncode(attribute2.SpecificationAttributeOption.Name) : "&nbsp;";
                                    }
                                }
                            }
                            productCell.Align  = "center";
                            productCell.VAlign = "top";
                            productRow.Cells.Add(productCell);
                        }
                        this.tblCompareProducts.Rows.Add(productRow);
                    }
                }
                string width = Math.Round((decimal)(90M / compareProducts.Count), 0).ToString() + "%";
                for (int i = 0; i < this.tblCompareProducts.Rows.Count; i++)
                {
                    HtmlTableRow row = this.tblCompareProducts.Rows[i];
                    for (int j = 1; j < row.Cells.Count; j++)
                    {
                        if (j == (row.Cells.Count - 1))
                        {
                            row.Cells[j].Style.Add("width", width);
                            row.Cells[j].Style.Add("text-align", "center");
                        }
                        else
                        {
                            row.Cells[j].Style.Add("width", width);
                            row.Cells[j].Style.Add("text-align", "center");
                        }
                    }
                }
            }
            else
            {
                btnClearCompareProductsList.Visible = false;
                tblCompareProducts.Visible          = false;
            }
        }
示例#11
0
        protected void dlRelatedProducts_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                RelatedProduct relatedProduct = e.Item.DataItem as RelatedProduct;
                Product        product        = relatedProduct.Product2;

                if (relatedProduct != null && product != null)
                {
                    string productURL = SEOHelper.GetProductURL(product);

                    Label lblPrice = e.Item.FindControl("lblPrice") as Label;

                    if (product.ProductVariants.Count > 0)
                    {
                        if (!product.HasMultipleVariants)
                        {
                            ProductVariant productVariant = product.ProductVariants[0];

                            decimal oldPriceBase = TaxManager.GetPrice(productVariant, productVariant.OldPrice);
                            decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));

                            decimal oldPrice = CurrencyManager.ConvertCurrency(oldPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                            decimal finalPriceWithoutDiscount = CurrencyManager.ConvertCurrency(finalPriceWithoutDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                            lblPrice.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscountBase);
                        }
                        else
                        {
                            ProductVariant productVariant = product.MinimalPriceProductVariant;
                            if (productVariant != null)
                            {
                                decimal fromPriceBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));
                                decimal fromPrice     = CurrencyManager.ConvertCurrency(fromPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                lblPrice.Text = String.Format(GetLocaleResourceString("Products.PriceRangeFromText"), PriceHelper.FormatPrice(fromPrice));
                            }
                        }
                    }
                    Image hlImageLink = e.Item.FindControl("hlImageLink") as Image;
                    if (hlImageLink != null)
                    {
                        ProductPictureCollection productPictures = product.ProductPictures;
                        if (productPictures.Count > 0)
                        {
                            hlImageLink.ImageUrl = PictureManager.GetPictureUrl(productPictures[0].Picture, SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 84), true);
                        }
                        else
                        {
                            hlImageLink.ImageUrl = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 84));
                        }
                        //hlImageLink.NavigateUrl = productURL;
                        //hlImageLink.ToolTip = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                        //hlImageLink.Text = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                    }

                    HyperLink hlProduct = e.Item.FindControl("hlProduct") as HyperLink;
                    if (hlProduct != null)
                    {
                        hlProduct.NavigateUrl = productURL;
                        //hlProduct.Text = product.Name;
                    }
                }
            }
        }
示例#12
0
        public void BindData()
        {
            if (blogComment != null)
            {
                lblCreatedOn.Text     = DateTimeHelper.ConvertToUserTime(blogComment.CreatedOn).ToString("g");
                lblComment.Text       = BlogManager.FormatCommentText(blogComment.CommentText);
                lblBlogCommentId.Text = blogComment.BlogCommentId.ToString();

                var customer = blogComment.Customer;
                if (customer != null)
                {
                    if (CustomerManager.AllowViewingProfiles)
                    {
                        hlUser.Text        = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.NavigateUrl = SEOHelper.GetUserProfileUrl(customer.CustomerId);
                        lblUser.Visible    = false;
                    }
                    else
                    {
                        lblUser.Text   = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.Visible = false;
                    }

                    if (CustomerManager.AllowCustomersToUploadAvatars)
                    {
                        var customerAvatar = customer.Avatar;
                        int avatarSize     = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                        if (customerAvatar != null)
                        {
                            string pictureUrl = PictureManager.GetPictureUrl(customerAvatar, avatarSize, false);
                            this.imgAvatar.ImageUrl = pictureUrl;
                        }
                        else
                        {
                            if (CustomerManager.DefaultAvatarEnabled)
                            {
                                string pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                                this.imgAvatar.ImageUrl = pictureUrl;
                            }
                            else
                            {
                                imgAvatar.Visible = false;
                            }
                        }
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                    }
                }
                else
                {
                    lblUser.Text   = GetLocaleResourceString("Customer.NotRegistered");
                    hlUser.Visible = false;
                    if (CustomerManager.AllowCustomersToUploadAvatars && CustomerManager.DefaultAvatarEnabled)
                    {
                        int    avatarSize = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                        string pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                        this.imgAvatar.ImageUrl = pictureUrl;
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                    }
                }
            }
        }
示例#13
0
        private void BindData()
        {
            if (product != null)
            {
                string productURL = SEOHelper.GetProductURL(product);

                hlProduct.Text = Server.HtmlEncode(product.Name);

                ProductPictureCollection productPictures = product.ProductPictures;
                if (productPictures.Count > 0)
                {
                    hlImageLink.ImageUrl = PictureManager.GetPictureUrl(productPictures[0].Picture, ProductImageSize, true);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                }
                else
                {
                    hlImageLink.ImageUrl = PictureManager.GetDefaultPictureUrl(this.ProductImageSize);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                }
                hlImageLink.NavigateUrl = productURL;

                lShortDescription.Text = product.ShortDescription;

                ProductVariantCollection productVariantCollection = product.ProductVariants;

                if (productVariantCollection.Count > 0)
                {
                    if (!product.HasMultipleVariants)
                    {
                        ProductVariant productVariant = productVariantCollection[0];

                        decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));

                        lblPrice.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscountBase);
                        if (Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD")
                        {
                            lblPrice.Text += "$";
                        }
                    }
                    else
                    {
                        ProductVariant productVariant = product.MinimalPriceProductVariant;
                        if (productVariant != null)
                        {
                            decimal fromPriceBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));
                            decimal fromPrice     = CurrencyManager.ConvertCurrency(fromPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                            lblPrice.Text = String.Format(GetLocaleResourceString("Products.PriceRangeFromText"), PriceHelper.FormatPrice(fromPrice));
                        }
                    }
                }
                else
                {
                    lblPrice.Visible = false;
                }

                #region scjaarge's change
                if (!lblPrice.Visible || lblPrice.Text.Trim() == string.Empty)
                {
                    litOrderOrNa.Text = "Нет в наличии";
                }
                #endregion scjaarge's change
            }
        }
示例#14
0
        /// <summary>
        /// Generate PriceGrabber feed
        /// </summary>
        /// <param name="stream">Stream</param>
        public static void GenerateFeed(Stream stream)
        {
            using (StreamWriter writer = new StreamWriter(stream))
            {
                writer.WriteLine("Unique Retailer SKU;Manufacturer Name;Manufacturer Part Number;Product Title;Categorization;Product URL;Image URL;Detailed Description;Selling Price;Condition;Availability");

                foreach (Product p in ProductManager.GetAllProducts(false))
                {
                    foreach (ProductVariant pv in ProductManager.GetProductVariantsByProductId(p.ProductId, false))
                    {
                        string sku = pv.ProductVariantId.ToString();
                        string manufacturerName       = p.ProductManufacturers.Count > 0 ? p.ProductManufacturers[0].Manufacturer.Name : String.Empty;
                        string manufacturerPartNumber = pv.ManufacturerPartNumber;
                        string productTitle           = pv.FullProductName;
                        string productUrl             = SEOHelper.GetProductUrl(p);

                        string imageUrl = string.Empty;
                        var    pictures = PictureManager.GetPicturesByProductId(p.ProductId, 1);
                        if (pictures.Count > 0)
                        {
                            imageUrl = PictureManager.GetPictureUrl(pictures[0], SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize"), true);
                        }
                        else
                        {
                            imageUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Entity, SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize"));
                        }

                        string description    = pv.Description;
                        string price          = pv.Price.ToString(new CultureInfo("en-US", false).NumberFormat);
                        string availability   = pv.StockQuantity > 0 ? "Yes" : "No";
                        string categorization = "no category";

                        if (String.IsNullOrEmpty(description))
                        {
                            description = p.FullDescription;
                        }
                        if (String.IsNullOrEmpty(description))
                        {
                            description = p.ShortDescription;
                        }
                        if (String.IsNullOrEmpty(description))
                        {
                            description = p.Name;
                        }

                        var productCategories = p.ProductCategories;
                        if (productCategories.Count > 0)
                        {
                            StringBuilder sb = new StringBuilder();
                            foreach (Category cat in CategoryManager.GetBreadCrumb(productCategories[0].CategoryId))
                            {
                                sb.AppendFormat("{0}>", cat.Name);
                            }
                            sb.Length     -= 1;
                            categorization = sb.ToString();
                        }

                        productTitle           = RemoveSpecChars(productTitle);
                        manufacturerPartNumber = RemoveSpecChars(manufacturerPartNumber);
                        manufacturerName       = RemoveSpecChars(manufacturerName);
                        description            = HtmlHelper.StripTags(description);
                        description            = RemoveSpecChars(description);
                        categorization         = RemoveSpecChars(categorization);

                        writer.WriteLine("{0};{1};{2};{3};{4};{5};{6};{7};{8};New;{9}",
                                         sku,
                                         manufacturerName,
                                         manufacturerPartNumber,
                                         productTitle,
                                         categorization,
                                         productUrl,
                                         imageUrl,
                                         description,
                                         price,
                                         availability);
                    }
                }
            }
        }
示例#15
0
        private void BindData()
        {
            var customer = CustomerManager.GetCustomerById(this.CustomerId);

            if (customer == null)
            {
                this.Visible = false;
                return;
            }

            if (CustomerManager.AllowCustomersToUploadAvatars)
            {
                phAvatar.Visible = true;
                var customerAvatar = customer.Avatar;
                int avatarSize     = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                if (customerAvatar != null)
                {
                    string pictureUrl = PictureManager.GetPictureUrl(customerAvatar, avatarSize, false);
                    this.imgAvatar.ImageUrl = pictureUrl;
                }
                else
                {
                    if (CustomerManager.DefaultAvatarEnabled)
                    {
                        string pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                        this.imgAvatar.ImageUrl = pictureUrl;
                    }
                    else
                    {
                        phAvatar.Visible = false;
                    }
                }
            }
            else
            {
                phAvatar.Visible = false;
            }

            phFullName.Visible = false;

            if (CustomerManager.ShowCustomersLocation)
            {
                phLocation.Visible = true;
                var country = CountryManager.GetCountryById(customer.CountryId);
                if (country != null)
                {
                    lblCountry.Text = Server.HtmlEncode(country.Name);
                }
                else
                {
                    phLocation.Visible = false;
                }
            }
            else
            {
                phLocation.Visible = false;
            }

            if (ForumManager.AllowPrivateMessages)
            {
                if (customer != null && !customer.IsGuest)
                {
                    btnSendPM.CustomerId = customer.CustomerId;
                    phPM.Visible         = true;
                }
                else
                {
                    phPM.Visible = false;
                }
            }
            else
            {
                phPM.Visible = false;
            }

            if (ForumManager.ForumsEnabled && ForumManager.ShowCustomersPostCount)
            {
                phTotalPosts.Visible = true;
                lblTotalPosts.Text   = customer.TotalForumPosts.ToString();
            }
            else
            {
                phTotalPosts.Visible = false;
            }

            if (CustomerManager.ShowCustomersJoinDate)
            {
                phJoinDate.Visible = true;
                lblJoinDate.Text   = DateTimeHelper.ConvertToUserTime(customer.RegistrationDate).ToString("f");
            }
            else
            {
                phJoinDate.Visible = false;
            }


            if (customer.DateOfBirth.HasValue)
            {
                lblDateOfBirth.Text = customer.DateOfBirth.Value.ToString("D");
            }
            else
            {
                phDateOfBirth.Visible = false;
            }

            if (ForumManager.ForumsEnabled)
            {
                int totaRecords = 0;
                int pageSize    = 5;
                if (ForumManager.LatestUserPostsPageSize > 0)
                {
                    pageSize = ForumManager.LatestUserPostsPageSize;
                }
                var forumPosts = ForumManager.GetAllPosts(0,
                                                          customer.CustomerId, string.Empty, false, pageSize, 0, out totaRecords);
                if (forumPosts.Count > 0)
                {
                    rptrLatestPosts.DataSource = forumPosts;
                    rptrLatestPosts.DataBind();
                }
                else
                {
                    phLatestPosts.Visible = false;
                }
            }
            else
            {
                phLatestPosts.Visible = false;
            }
        }
        protected void BindData()
        {
            Product product = ProductManager.GetProductByID(ProductID);
            if (product != null)
            {
                ProductVariantCollection productVariantCollection = product.ProductVariants;
                ProductVariant productVariant = null;
                if (productVariantCollection.Count > 0)
                {
                    if (!product.HasMultipleVariants)
                    {
                        productVariant = productVariantCollection[0];

                        decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));

                        lblPrice2.Text = PriceHelper.FormatPrice(finalPriceWithoutDiscountBase);
                        if (Request.Cookies["Currency"] != null && Request.Cookies["Currency"].Value == "USD")
                        {
                            lblPrice1.Text = lblPrice2.Text = lblPrice2.Text + "$";
                        }
                        else
                        {
                            lblPrice1.Text = lblPrice2.Text + " руб";
                        }
                    }
                    else
                    {
                        productVariant = product.MinimalPriceProductVariant;
                        if (productVariant != null)
                        {
                            decimal fromPriceBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));
                            decimal fromPrice = CurrencyManager.ConvertCurrency(fromPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                            lblPrice2.Text = String.Format(GetLocaleResourceString("Products.PriceRangeFromText"), PriceHelper.FormatPrice(fromPrice));
                            lblPrice1.Text = String.Format(GetLocaleResourceString("Products.PriceRangeFromText"), PriceHelper.FormatPrice(fromPrice));
                        }
                    }
                }

                lProductName.Text = Server.HtmlEncode(product.Name);
                lShortDescription.Text = product.ShortDescription;
                lFullDescription.Text = product.FullDescription;
                imgProduct.Alt = AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);

                if (product.ProductPictures.Count > 0)
                {
                    imgProduct.Src = PictureManager.GetPictureUrl(product.ProductPictures[0].PictureID, middleImageSize);
                    a_imgProduct.HRef = DefaultHref = PictureManager.GetPictureUrl(product.ProductPictures[0].PictureID, largeImageSize);
                }
                else
                {
                    imgProduct.Src = PictureManager.GetDefaultPictureUrl(middleImageSize);
                    a_imgProduct.HRef = DefaultHref = PictureManager.GetDefaultPictureUrl(largeImageSize); ;
                }
                ProductPictureCollection productPictures = product.ProductPictures;
                if (productPictures.Count > 1)
                {
                    this.dlImages.DataSource = productPictures;
                    this.dlImages.DataBind();
                }
                else
                {
                    PanelImages.Visible = false;
                }

                lbOrder.CommandArgument = product.ProductID.ToString();
                lbOrderAndCheckout.CommandArgument = product.ProductID.ToString();
                tblOrderButtons.Visible = productVariantCollection.Count != 0 && productVariantCollection[0].StockQuantity != 0;


                StringBuilder attributes = new StringBuilder();
                foreach (ProductSpecificationAttribute psa in SpecificationAttributeManager.GetProductSpecificationAttributesByProductID(product.ProductID, false, null))
                {
                    if (psa.SpecificationAttribute.Name == "Уникальное предложение")
                        pUniqueProposal.Visible = psa.SpecificationAttributeOption.Name == "Да";
                    else
                        attributes.AppendFormat(@"<p><span class=""pink"">{0}:</span> {1}</p>", psa.SpecificationAttribute.Name, psa.SpecificationAttributeOption.Name);
                }

                lblAttributes.Text += attributes.ToString();
                if (NopContext.Current.Session == null)
                    NopContext.Current.Session = NopContext.Current.GetSession(true);
                Guid CustomerSessionGUID = NopContext.Current.Session.CustomerSessionGUID;
                ViewedItemManager.InsertViewedItem(CustomerSessionGUID, productVariant.ProductVariantID, DateTime.Now); 
            }
            else
                Visible = false;
        }
示例#17
0
        public void BindData()
        {
            if (forumPost != null)
            {
                lAnchor.Text = string.Format("<a name=\"{0}\"></a>", forumPost.ForumPostID);

                btnEdit.Visible   = ForumManager.IsUserAllowedToEditPost(NopContext.Current.User, forumPost);
                btnDelete.Visible = ForumManager.IsUserAllowedToDeletePost(NopContext.Current.User, forumPost);

                lblDate.Text        = DateTimeHelper.ConvertToUserTime(forumPost.CreatedOn).ToString("f");
                lblText.Text        = ForumManager.FormatPostText(forumPost.Text);
                lblForumPostID.Text = forumPost.ForumPostID.ToString();

                Customer customer = forumPost.User;
                if (customer != null)
                {
                    if (CustomerManager.AllowViewingProfiles)
                    {
                        hlUser.Text        = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.NavigateUrl = SEOHelper.GetUserProfileURL(customer.CustomerID);
                        lblUser.Visible    = false;
                    }
                    else
                    {
                        lblUser.Text   = Server.HtmlEncode(CustomerManager.FormatUserName(customer));
                        hlUser.Visible = false;
                    }

                    if (CustomerManager.AllowCustomersToUploadAvatars)
                    {
                        Picture customerAvatar = customer.Avatar;
                        int     avatarSize     = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                        if (customerAvatar != null)
                        {
                            string pictureUrl = PictureManager.GetPictureUrl(customerAvatar, avatarSize, false);
                            this.imgAvatar.ImageUrl = pictureUrl;
                        }
                        else
                        {
                            if (CustomerManager.DefaultAvatarEnabled)
                            {
                                string pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                                this.imgAvatar.ImageUrl = pictureUrl;
                            }
                            else
                            {
                                imgAvatar.Visible = false;
                            }
                        }
                    }
                    else
                    {
                        imgAvatar.Visible = false;
                    }

                    if (customer.IsForumModerator)
                    {
                        lblStatus.Text = GetLocaleResourceString("Forum.Moderator");
                    }
                    else
                    {
                        phStatus.Visible = false;
                    }

                    if (ForumManager.ShowCustomersPostCount)
                    {
                        lblTotalPosts.Text = customer.TotalForumPosts.ToString();
                    }
                    else
                    {
                        phTotalPosts.Visible = false;
                    }

                    if (CustomerManager.ShowCustomersJoinDate)
                    {
                        lblJoined.Text = DateTimeHelper.ConvertToUserTime(customer.RegistrationDate).ToString("d");
                    }
                    else
                    {
                        phJoined.Visible = false;
                    }

                    if (CustomerManager.ShowCustomersLocation)
                    {
                        Country country = CountryManager.GetCountryByID(customer.CountryID);
                        if (country != null)
                        {
                            lblLocation.Text = Server.HtmlEncode(country.Name);
                        }
                        else
                        {
                            phLocation.Visible = false;
                        }
                    }
                    else
                    {
                        phLocation.Visible = false;
                    }

                    if (ForumManager.AllowPrivateMessages)
                    {
                        if (customer != null && !customer.IsGuest)
                        {
                            btnSendPM.CustomerID = customer.CustomerID;
                            phPM.Visible         = true;
                        }
                        else
                        {
                            phPM.Visible = false;
                        }
                    }
                    else
                    {
                        phPM.Visible = false;
                    }

                    if (ForumManager.SignaturesEnabled && !String.IsNullOrEmpty(customer.Signature))
                    {
                        lblSignature.Text = ForumManager.FormatSignatureText(customer.Signature);
                    }
                    else
                    {
                        pnlSignature.Visible = false;
                    }
                }
                else
                {
                    //error, cannot be
                }
            }
        }
示例#18
0
        private void BindData()
        {
            //general info
            var customer = CustomerManager.GetCustomerById(this.CustomerId);

            if (customer == null)
            {
                this.Visible = false;
                return;
            }

            //avatar
            if (CustomerManager.AllowCustomersToUploadAvatars)
            {
                phAvatar.Visible = true;
                var customerAvatar = customer.Avatar;
                int avatarSize     = SettingManager.GetSettingValueInteger("Media.Customer.AvatarSize", 85);
                if (customerAvatar != null)
                {
                    string pictureUrl = PictureManager.GetPictureUrl(customerAvatar, avatarSize, false);
                    this.imgAvatar.ImageUrl = pictureUrl;
                }
                else
                {
                    if (CustomerManager.DefaultAvatarEnabled)
                    {
                        string pictureUrl = PictureManager.GetDefaultPictureUrl(PictureTypeEnum.Avatar, avatarSize);
                        this.imgAvatar.ImageUrl = pictureUrl;
                    }
                    else
                    {
                        phAvatar.Visible = false;
                    }
                }
            }
            else
            {
                phAvatar.Visible = false;
            }

            //name
            phFullName.Visible = false;

            //location
            if (CustomerManager.ShowCustomersLocation)
            {
                phLocation.Visible = true;
                var country = CountryManager.GetCountryById(customer.CountryId);
                if (country != null)
                {
                    lblCountry.Text = Server.HtmlEncode(country.Name);
                }
                else
                {
                    phLocation.Visible = false;
                }
            }
            else
            {
                phLocation.Visible = false;
            }

            //private message
            if (ForumManager.AllowPrivateMessages)
            {
                if (customer != null && !customer.IsGuest)
                {
                    btnSendPM.CustomerId = customer.CustomerId;
                    phPM.Visible         = true;
                }
                else
                {
                    phPM.Visible = false;
                }
            }
            else
            {
                phPM.Visible = false;
            }

            //total forum posts
            if (ForumManager.ForumsEnabled && ForumManager.ShowCustomersPostCount)
            {
                phTotalPosts.Visible = true;
                lblTotalPosts.Text   = customer.TotalForumPosts.ToString();
            }
            else
            {
                phTotalPosts.Visible = false;
            }

            //registration date
            if (CustomerManager.ShowCustomersJoinDate)
            {
                phJoinDate.Visible = true;
                lblJoinDate.Text   = DateTimeHelper.ConvertToUserTime(customer.RegistrationDate, DateTimeKind.Utc).ToString("f");
            }
            else
            {
                phJoinDate.Visible = false;
            }

            //birth date
            if (customer.DateOfBirth.HasValue)
            {
                lblDateOfBirth.Text = customer.DateOfBirth.Value.ToString("D");
            }
            else
            {
                phDateOfBirth.Visible = false;
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string title = GetLocaleResourceString("PageTitle.ComposerDetailsPage");

            SEOHelper.RenderTitle(this, title, true);
            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["ComposerID"]))
                {
                    string PId = Request.QueryString["ComposerID"].ToString();

                    long PersonId = 0;

                    if (long.TryParse(PId, out PersonId))
                    {
                        try
                        {
                            PersonBiz  pb     = new PersonBiz();
                            lwg_Person person = pb.GetByID(PersonId);

                            if (person != null)
                            {
                                this.litName.Text = person.NameDisplay;
                                this.lblName.Text = person.NameDisplay;

                                this.Literal1.Text = "About " + person.NameDisplay;

                                if (!String.IsNullOrEmpty(person.Biography))
                                {
                                    this.Literal2.Text = Custring(person.Biography);
                                }

                                if (person.PictureID.HasValue)
                                {
                                    if (person.PictureID.Value > 0)
                                    {
                                        Picture Picture    = PictureManager.GetPictureById(person.PictureID.Value);
                                        string  pictureUrl = PictureManager.GetPictureUrl(Picture, 150);
                                        this.iPicture.Visible  = true;
                                        this.iPicture.ImageUrl = pictureUrl;
                                    }
                                }
                                else
                                {
                                    iPicture.ImageUrl = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 150));
                                }
                            }
                            else
                            {
                                Response.Write("This composer doesn't exist.");
                            }
                        }
                        catch (Exception ex)
                        {
                            Response.Write(ex.Message);
                        }
                        return;
                    }
                }

                // Invalid Person ID. Go to Composers page or 404 page.
                Response.Redirect("~/MeetComposers.aspx");
            }
        }
示例#20
0
        protected void GenerateCompareTable()
        {
            this.tblCompareProducts.Rows.Clear();
            this.tblCompareProducts.Width = "100%";
            var compareProducts = ProductManager.GetCompareProducts();

            if (compareProducts.Count > 0)
            {
                var headerRow = new HtmlTableRow();
                this.AddCell(headerRow, "&nbsp;");
                var productNameRow = new HtmlTableRow();
                this.AddCell(productNameRow, "&nbsp;");
                var priceRow = new HtmlTableRow();
                var cell     = new HtmlTableCell();
                cell.InnerText = GetLocaleResourceString("Products.CompareProductsPrice");
                cell.Align     = "center";
                priceRow.Cells.Add(cell);

                var specificationAttributeIds = new List <int>();
                foreach (var product in compareProducts)
                {
                    var productSpecificationAttributes = SpecificationAttributeManager.GetProductSpecificationAttributesByProductId(product.ProductId, null, true);
                    foreach (var attribute in productSpecificationAttributes)
                    {
                        if (!specificationAttributeIds.Contains(attribute.SpecificationAttribute.SpecificationAttributeId))
                        {
                            specificationAttributeIds.Add(attribute.SpecificationAttribute.SpecificationAttributeId);
                        }
                    }
                }

                foreach (var product in compareProducts)
                {
                    var headerCell        = new HtmlTableCell();
                    var headerCellDiv     = new HtmlGenericControl("div");
                    var btnRemoveFromList = new Button();
                    btnRemoveFromList.ToolTip          = GetLocaleResourceString("Products.CompareProductsRemoveFromList");
                    btnRemoveFromList.Text             = GetLocaleResourceString("Products.CompareProductsRemoveFromList");
                    btnRemoveFromList.CommandName      = "Remove";
                    btnRemoveFromList.Command         += new CommandEventHandler(this.btnRemoveFromList_Command);
                    btnRemoveFromList.CommandArgument  = product.ProductId.ToString();
                    btnRemoveFromList.CausesValidation = false;
                    btnRemoveFromList.CssClass         = "remove-button";
                    btnRemoveFromList.ID = "btnRemoveFromList" + product.ProductId.ToString();
                    headerCellDiv.Controls.Add(btnRemoveFromList);

                    var productImagePanel = new HtmlGenericControl("p");
                    productImagePanel.Attributes.Add("align", "center");

                    var productImage = new HtmlImage();
                    productImage.Border = 0;
                    //productImage.Align = "center";
                    productImage.Alt = "Product image";
                    var picture = product.DefaultPicture;
                    if (picture != null)
                    {
                        productImage.Src = PictureManager.GetPictureUrl(picture, SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125), true);
                    }
                    else
                    {
                        productImage.Src = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.ThumbnailImageSize", 125));
                    }
                    productImagePanel.Controls.Add(productImage);
                    headerCellDiv.Controls.Add(productImagePanel);

                    headerCell.Controls.Add(headerCellDiv);
                    headerRow.Cells.Add(headerCell);
                    var productNameCell = new HtmlTableCell();
                    var productLink     = new HyperLink();
                    productLink.Text        = Server.HtmlEncode(product.LocalizedName);
                    productLink.NavigateUrl = SEOHelper.GetProductUrl(product);
                    productLink.Attributes.Add("class", "link");
                    productNameCell.Align = "center";
                    productNameCell.Controls.Add(productLink);
                    productNameRow.Cells.Add(productNameCell);
                    var priceCell = new HtmlTableCell();
                    priceCell.Align = "center";
                    var productVariantCollection = product.ProductVariants;
                    if (productVariantCollection.Count > 0)
                    {
                        var     productVariant = productVariantCollection[0];
                        decimal taxRate        = decimal.Zero;
                        decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false), out taxRate);
                        decimal finalPriceWithoutDiscount     = CurrencyManager.ConvertCurrency(finalPriceWithoutDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                        priceCell.InnerText = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                    }
                    priceRow.Cells.Add(priceCell);
                }
                productNameRow.Attributes.Add("class", "product-name");
                priceRow.Attributes.Add("class", "productPrice");
                this.tblCompareProducts.Rows.Add(headerRow);
                this.tblCompareProducts.Rows.Add(productNameRow);
                if (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                    (NopContext.Current.User != null &&
                     !NopContext.Current.User.IsGuest))
                {
                    this.tblCompareProducts.Rows.Add(priceRow);
                }

                foreach (int specificationAttributeId in specificationAttributeIds)
                {
                    var specificationAttribute = SpecificationAttributeManager.GetSpecificationAttributeById(specificationAttributeId);
                    var productRow             = new HtmlTableRow();
                    this.AddCell(productRow, Server.HtmlEncode(specificationAttribute.LocalizedName)).Align = "left";

                    foreach (var product2 in compareProducts)
                    {
                        var productCell = new HtmlTableCell();
                        {
                            var productSpecificationAttributes2 = SpecificationAttributeManager.GetProductSpecificationAttributesByProductId(product2.ProductId, null, true);
                            foreach (var psa2 in productSpecificationAttributes2)
                            {
                                if (specificationAttribute.SpecificationAttributeId == psa2.SpecificationAttribute.SpecificationAttributeId)
                                {
                                    productCell.InnerHtml = (!String.IsNullOrEmpty(psa2.SpecificationAttributeOption.LocalizedName)) ? Server.HtmlEncode(psa2.SpecificationAttributeOption.LocalizedName) : "&nbsp;";
                                }
                            }
                        }
                        productCell.Align  = "center";
                        productCell.VAlign = "top";
                        productRow.Cells.Add(productCell);
                    }
                    this.tblCompareProducts.Rows.Add(productRow);
                }

                string width = Math.Round((decimal)(90M / compareProducts.Count), 0).ToString() + "%";
                for (int i = 0; i < this.tblCompareProducts.Rows.Count; i++)
                {
                    var row = this.tblCompareProducts.Rows[i];
                    for (int j = 1; j < row.Cells.Count; j++)
                    {
                        if (j == (row.Cells.Count - 1))
                        {
                            row.Cells[j].Style.Add("width", width);
                            row.Cells[j].Style.Add("text-align", "center");
                        }
                        else
                        {
                            row.Cells[j].Style.Add("width", width);
                            row.Cells[j].Style.Add("text-align", "center");
                        }
                    }
                }
            }
            else
            {
                btnClearCompareProductsList.Visible = false;
                tblCompareProducts.Visible          = false;
            }
        }
示例#21
0
        protected void BindData()
        {
            var product = ProductManager.GetProductById(this.ProductId);

            if (product != null)
            {
                ctrlProductRating.Visible = product.AllowCustomerRatings;
                //Get product extend information
                CatalogBiz  cService = new CatalogBiz();
                lwg_Catalog catalog  = cService.GetByID(product.ProductId);

                lProductName.Text      = Server.HtmlEncode(product.Name);
                lProductName1.Text     = Server.HtmlEncode(product.Name);
                lShortDescription.Text = product.ShortDescription;
                lFullDescription.Text  = product.FullDescription;
                lTableofContents.Text  = catalog.TableofContents;
                ltrSubtitle.Text       = catalog.Subtitle;

                var productPictures = product.ProductPictures;
                if (productPictures.Count > 1)
                {
                    defaultImage.ImageUrl        = PictureManager.GetPictureUrl(productPictures[0].PictureId, SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    defaultImage.ToolTip         = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                    defaultImage.AlternateText   = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                    lvProductPictures.DataSource = productPictures;
                    lvProductPictures.DataBind();
                }
                else if (productPictures.Count == 1)
                {
                    defaultImage.ImageUrl      = PictureManager.GetPictureUrl(productPictures[0].PictureId, SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    defaultImage.ToolTip       = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                    defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                    lvProductPictures.Visible  = false;
                }
                else
                {
                    defaultImage.ImageUrl      = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    defaultImage.ToolTip       = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                    defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                    lvProductPictures.Visible  = false;
                }



                if (catalog != null)
                {
                    lProductName.Text = catalog.CatalogNumber + " - " + lProductName.Text;
                    //lProductName1.Text = catalog.TitleDisplay;
                    string strCompare = "http://";

                    AudioBiz audioBiz = new AudioBiz();
                    //lwg_Audio audio = audioBiz.GetSoundFile(catalog.CatalogId);
                    //if (audio != null)
                    //{
                    //    if (audio.SoundFile.TrimStart().StartsWith(strCompare))
                    //    {
                    //        hplListenToTheSample.NavigateUrl = audio.SoundFile;
                    //    }
                    //    else
                    //    {
                    //        hplListenToTheSample.NavigateUrl = string.Format("{0}{1}", LWGUtils.GetSoundPath(), audio.SoundFile);
                    //    }

                    //}
                    List <lwg_Audio> audioList = audioBiz.GetAllSoundFiles(catalog.CatalogId);
                    if (audioList.Count > 0)
                    {
                        dlListenMusics.DataSource = audioList;
                        dlListenMusics.DataBind();
                        divListenToTheSample.Attributes.Add("style", "display:block;");
                    }

                    if (!string.IsNullOrEmpty(catalog.PDF))
                    {
                        hplPreviewMusic.NavigateUrl = string.Format("{0}{1}", LWGUtils.GetPDFPath(), catalog.PDF);
                        divPreviewMusic.Attributes.Add("style", "display:block;");
                    }


                    if (catalog.lwg_PersonInRole != null && catalog.lwg_PersonInRole.Count > 0)
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (lwg_PersonInRole catComposer in catalog.lwg_PersonInRole.OrderBy(p => p.RoleId))
                        {
                            if (catComposer.RoleId == LWGUtils.COMPOSER_ROLE_ID)
                            {
                                sb.Insert(0, string.Format("{0} ({1}), ", catComposer.lwg_Person.NameDisplay, catComposer.lwg_Role.Name));
                            }
                            else
                            {
                                sb.Append(catComposer.lwg_Person.NameDisplay).Append(" (" + catComposer.lwg_Role.Name).Append("), ");
                            }
                        }

                        string composer = sb.ToString();
                        if (composer.Length > 0)
                        {
                            try
                            {
                                composer = composer.Substring(0, composer.Length - 2);
                            }
                            catch
                            {
                                ;
                            }
                        }
                        ltrComposer.Text = "by " + composer;
                    }
                    else
                    {
                        ltrComposer.Text = string.Empty;
                    }

                    if (product.ProductVariants.Count > 0)
                    {
                        this.ltrPrice.Text = string.Format("{0:c}", product.ProductVariants[0].Price);
                        productVariantRepeater.DataSource = product.ProductVariants.OrderBy(pv => pv.Price);
                        productVariantRepeater.DataBind();
                    }
                    else
                    {
                        this.ltrPrice.Text = string.Format("{0:c}", "0");
                    }

                    this.ltrDuration.Text = catalog.Duration;
                    if (catalog.lwg_Instrumental != null)
                    {
                        this.ltrInstrumention.Text = catalog.lwg_Instrumental.LongName;
                    }

                    this.ltrYear.Text   = catalog.Year;
                    this.ltrPeriod.Text = string.Empty;

                    List <lwg_PeriodMapping> lstPeriod = new PeriodBiz().GetListPeriodMappingByCatalogID(ProductId);
                    if (lstPeriod != null && lstPeriod.Count > 0)
                    {
                        foreach (lwg_PeriodMapping lwg in lstPeriod)
                        {
                            this.ltrPeriod.Text += lwg.lwg_Period.Name + ", ";
                        }
                        this.ltrPeriod.Text = this.ltrPeriod.Text.Substring(0, this.ltrPeriod.Text.Length - 2);
                    }

                    if (catalog.lwg_CatalogGenre != null && catalog.lwg_CatalogGenre.Count > 0)
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (lwg_CatalogGenre catalogGenre in catalog.lwg_CatalogGenre)
                        {
                            sb.Append(catalogGenre.lwg_Genre.Name).Append(", ");
                        }

                        string genre = sb.ToString();
                        if (genre.Length > 0)
                        {
                            try
                            {
                                genre = genre.Substring(0, genre.Length - 2);
                            }
                            catch
                            {
                                ;
                            }
                        }

                        this.ltrGenre.Text    = genre;
                        this.lblGenre.Visible = (genre != ""); // hide when blank field
                    }

                    this.ltrOrigPrint.Text = string.Empty;
                    List <lwg_ReprintSourceMapping> lstReprintSourceMapping = new ReprintSourceBiz().GetListReprintSourceMappingByCatalogID(ProductId);
                    if (lstReprintSourceMapping != null && lstReprintSourceMapping.Count > 0)
                    {
                        foreach (lwg_ReprintSourceMapping lwg in lstReprintSourceMapping)
                        {
                            this.ltrOrigPrint.Text += lwg.lwg_ReprintSource.Name + ", ";
                        }
                        this.ltrOrigPrint.Text = this.ltrOrigPrint.Text.Substring(0, this.ltrOrigPrint.Text.Length - 2);
                    }


                    if (product.ProductCategories != null && product.ProductCategories.Count > 0)
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (ProductCategory productCat in product.ProductCategories)
                        {
                            sb.Append(productCat.Category.Name).Append(", ");
                        }

                        string category = sb.ToString();
                        if (category.Length > 0)
                        {
                            try
                            {
                                category = category.Substring(0, category.Length - 3);
                            }
                            catch
                            {
                                ;
                            }
                        }
                        this.ltrCategory.Text = category;
                    }

                    this.ltrSeries.Text = string.Empty;
                    List <lwg_SeriesMapping> lstSeriesMapping = new SeriesBiz().GetListSeriesMappingByCatalogID(ProductId);
                    if (lstSeriesMapping != null && lstSeriesMapping.Count > 0)
                    {
                        foreach (lwg_SeriesMapping lwg in lstSeriesMapping)
                        {
                            this.ltrSeries.Text += lwg.lwg_Series.Name + ", ";
                        }
                        this.ltrSeries.Text = this.ltrSeries.Text.Substring(0, this.ltrSeries.Text.Length - 2);
                    }

                    this.ltrText.Text          = catalog.TextLang;
                    this.lGrade.Text           = catalog.Grade;
                    this.ltrCopyrightYear.Text = catalog.CopyrightYear;
                    InitLabels(); // hide if blank field

                    // add Grade Product Info
                }
                else
                {
                }
            }
            else
            {
                this.Visible = false;
            }
        }
示例#22
0
        private void BindData()
        {
            if (product != null)
            {
                string productURL = SEOHelper.GetProductUrl(product);

                hlProduct.NavigateUrl = productURL;
                hlProduct.Text        = Server.HtmlEncode(product.Name);

                ProductPicture productPicture = product.DefaultProductPicture;
                if (productPicture != null)
                {
                    hlImageLink.ImageUrl = PictureManager.GetPictureUrl(productPicture.Picture, this.ProductImageSize, true);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                }
                else
                {
                    hlImageLink.ImageUrl = PictureManager.GetDefaultPictureUrl(this.ProductImageSize);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                }
                hlImageLink.NavigateUrl = productURL;

                lShortDescription.Text = product.ShortDescription;

                var productVariantCollection = product.ProductVariants;
                if (productVariantCollection.Count > 0)
                {
                    if (!product.HasMultipleVariants)
                    {
                        var productVariant = productVariantCollection[0];
                        btnAddToCart.Visible = (!productVariant.DisableBuyButton);

                        if (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                            (NopContext.Current.User != null &&
                             !NopContext.Current.User.IsGuest))
                        {
                            if (productVariant.CustomerEntersPrice)
                            {
                                lblOldPrice.Visible = false;
                                lblPrice.Visible    = false;
                            }
                            else
                            {
                                decimal oldPriceBase = TaxManager.GetPrice(productVariant, productVariant.OldPrice);
                                decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));

                                decimal oldPrice = CurrencyManager.ConvertCurrency(oldPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                decimal finalPriceWithoutDiscount = CurrencyManager.ConvertCurrency(finalPriceWithoutDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                                if (finalPriceWithoutDiscountBase != oldPriceBase && oldPriceBase != decimal.Zero)
                                {
                                    lblOldPrice.Text = PriceHelper.FormatPrice(oldPrice);
                                    lblPrice.Text    = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                                }
                                else
                                {
                                    lblOldPrice.Visible = false;
                                    lblPrice.Text       = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                                }
                            }
                        }
                        else
                        {
                            lblOldPrice.Visible  = false;
                            lblPrice.Visible     = false;
                            btnAddToCart.Visible = false;
                        }
                    }
                    else
                    {
                        var productVariant = product.MinimalPriceProductVariant;
                        if (productVariant != null)
                        {
                            if (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                                (NopContext.Current.User != null &&
                                 !NopContext.Current.User.IsGuest))
                            {
                                if (productVariant.CustomerEntersPrice)
                                {
                                    lblOldPrice.Visible = false;
                                    lblPrice.Visible    = false;
                                }
                                else
                                {
                                    decimal fromPriceBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));
                                    decimal fromPrice     = CurrencyManager.ConvertCurrency(fromPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                    lblOldPrice.Visible = false;
                                    lblPrice.Text       = String.Format(GetLocaleResourceString("Products.PriceRangeFromText"), PriceHelper.FormatPrice(fromPrice));
                                }
                            }
                            else
                            {
                                lblOldPrice.Visible  = false;
                                lblPrice.Visible     = false;
                                btnAddToCart.Visible = false;
                            }
                        }

                        btnAddToCart.Visible = false;
                    }
                }
                else
                {
                    lblOldPrice.Visible  = false;
                    lblPrice.Visible     = false;
                    btnAddToCart.Visible = false;
                }
            }
        }
示例#23
0
        protected void BindData()
        {
            var product = ProductManager.GetProductById(this.ProductId);

            if (product != null)
            {
                lProductName.Text      = Server.HtmlEncode(product.LocalizedName);
                lShortDescription.Text = product.LocalizedShortDescription;
                lFullDescription.Text  = product.LocalizedFullDescription;

                //manufacturers
                List <Manufacturer> manufacturers = new List <Manufacturer>();
                foreach (var pm in product.ProductManufacturers)
                {
                    var manufacturer = pm.Manufacturer;
                    if (manufacturer != null)
                    {
                        manufacturers.Add(manufacturer);
                    }
                }
                if (manufacturers.Count > 0)
                {
                    if (manufacturers.Count == 1)
                    {
                        lManufacturersTitle.Text = GetLocaleResourceString("Products.Manufacturer");
                    }
                    else
                    {
                        lManufacturersTitle.Text = GetLocaleResourceString("Products.Manufacturers");
                    }
                    rptrManufacturers.DataSource = manufacturers;
                    rptrManufacturers.DataBind();
                }
                else
                {
                    phManufacturers.Visible = false;
                }

                //pictures
                var pictures = PictureManager.GetPicturesByProductId(product.ProductId);
                if (pictures.Count > 1)
                {
                    defaultImage.ImageUrl        = PictureManager.GetPictureUrl(pictures[0], SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    defaultImage.ToolTip         = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    defaultImage.AlternateText   = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    lvProductPictures.DataSource = pictures;
                    lvProductPictures.DataBind();
                }
                else if (pictures.Count == 1)
                {
                    defaultImage.ImageUrl      = PictureManager.GetPictureUrl(pictures[0], SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    defaultImage.ToolTip       = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    lvProductPictures.Visible  = false;
                }
                else
                {
                    defaultImage.ImageUrl      = PictureManager.GetDefaultPictureUrl(SettingManager.GetSettingValueInteger("Media.Product.DetailImageSize", 300));
                    defaultImage.ToolTip       = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    defaultImage.AlternateText = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.LocalizedName);
                    lvProductPictures.Visible  = false;
                }
                if (SettingManager.GetSettingValueBoolean("Media.Product.DefaultPictureZoomEnabled", false))
                {
                    var picture = product.DefaultPicture;
                    if (picture != null)
                    {
                        lnkMainLightbox.Attributes["href"] = PictureManager.GetPictureUrl(picture);
                        lnkMainLightbox.Attributes["rel"]  = "lightbox-pd";
                    }
                }
            }
            else
            {
                this.Visible = false;
            }
        }
示例#24
0
        private void BindData()
        {
            if (product != null)
            {
                string productURL = SEOHelper.GetProductUrl(product);

                LWG.Business.CatalogBiz catalogBiz = new LWG.Business.CatalogBiz();
                lwg_Catalog             catalog    = catalogBiz.GetByID(product.ProductId);

                hlCatalogNo.Text      = Server.HtmlEncode(catalog.CatalogNumber);
                hlProduct.NavigateUrl = hlCatalogNo.NavigateUrl = productURL;
                hlProduct.Text        = Server.HtmlEncode(product.Name);

                ProductPicture productPicture = product.DefaultProductPicture;
                if (productPicture != null)
                {
                    hlImageLink.ImageUrl = PictureManager.GetPictureUrl(productPicture.Picture, this.ProductImageSize, true);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                }
                else
                {
                    hlImageLink.ImageUrl = PictureManager.GetDefaultPictureUrl(this.ProductImageSize);
                    hlImageLink.ToolTip  = String.Format(GetLocaleResourceString("Media.Product.ImageLinkTitleFormat"), product.Name);
                    hlImageLink.Text     = String.Format(GetLocaleResourceString("Media.Product.ImageAlternateTextFormat"), product.Name);
                }
                hlImageLink.NavigateUrl = productURL;

                lShortDescription.Text = product.ShortDescription;

                var productVariantCollection = product.ProductVariants;

                if (productVariantCollection.Count > 0)
                {
                    if (!product.HasMultipleVariants)
                    {
                        var productVariant = productVariantCollection[0];
                        btnAddToCart.Visible = (!productVariant.DisableBuyButton);
                        if (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                            (NopContext.Current.User != null &&
                             !NopContext.Current.User.IsGuest))
                        {
                            if (productVariant.CustomerEntersPrice)
                            {
                                lblOldPrice.Visible = false;
                                lblPrice.Visible    = false;
                            }
                            else
                            {
                                decimal oldPriceBase = TaxManager.GetPrice(productVariant, productVariant.OldPrice);
                                decimal finalPriceWithoutDiscountBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));

                                decimal oldPrice = CurrencyManager.ConvertCurrency(oldPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                decimal finalPriceWithoutDiscount = CurrencyManager.ConvertCurrency(finalPriceWithoutDiscountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);

                                if (finalPriceWithoutDiscountBase != oldPriceBase && oldPriceBase != decimal.Zero)
                                {
                                    lblOldPrice.Text = PriceHelper.FormatPrice(oldPrice);
                                    lblPrice.Text    = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                                }
                                else
                                {
                                    lblOldPrice.Visible = false;
                                    lblPrice.Text       = PriceHelper.FormatPrice(finalPriceWithoutDiscount);
                                }
                            }
                        }
                        else
                        {
                            lblOldPrice.Visible  = false;
                            lblPrice.Visible     = false;
                            btnAddToCart.Visible = false;
                        }
                        ddlVariantPrice.Visible = false;
                    }
                    else
                    {
                        lblOldPrice.Visible  = false;
                        lblPrice.Visible     = false;
                        btnAddToCart.Visible = false;

                        ddlVariantPrice.Visible    = true;
                        ddlVariantPrice.DataSource = productVariantCollection.OrderBy(pv => pv.Price);
                        ddlVariantPrice.DataBind();
                        #region comment built-in code
                        //var productVariant = product.MinimalPriceProductVariant;
                        //if (productVariant != null)
                        //{
                        //    if (!SettingManager.GetSettingValueBoolean("Common.HidePricesForNonRegistered") ||
                        //        (NopContext.Current.User != null &&
                        //        !NopContext.Current.User.IsGuest))
                        //    {
                        //        if (productVariant.CustomerEntersPrice)
                        //        {
                        //            lblOldPrice.Visible = false;
                        //            lblPrice.Visible = false;
                        //        }
                        //        else
                        //        {
                        //            decimal fromPriceBase = TaxManager.GetPrice(productVariant, PriceHelper.GetFinalPrice(productVariant, false));
                        //            decimal fromPrice = CurrencyManager.ConvertCurrency(fromPriceBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                        //            lblOldPrice.Visible = false;
                        //            lblPrice.Text = String.Format(GetLocaleResourceString("Products.PriceRangeFromText"), PriceHelper.FormatPrice(fromPrice));
                        //        }
                        //    }
                        //    else
                        //    {
                        //        lblOldPrice.Visible = false;
                        //        lblPrice.Visible = false;
                        //        btnAddToCart.Visible = false;
                        //    }
                        //}

                        //btnAddToCart.Visible = false;
                        #endregion
                    }
                }
                else
                {
                    lblOldPrice.Visible  = false;
                    lblPrice.Visible     = false;
                    btnAddToCart.Visible = false;
                }
            }
        }