protected void dlSubCategories_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            var category = e.Item.DataItem as Category;

            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                var hlImageLink = e.Item.FindControl("hlImageLink") as HyperLink;
                if (hlImageLink != null)
                {
                    hlImageLink.ImageUrl    = PictureManager.GetPictureUrl(category.PictureId, SettingManager.GetSettingValueInteger("Media.Category.ThumbnailImageSize", 125), true);
                    hlImageLink.NavigateUrl = SEOHelper.GetCategoryUrl(category.CategoryId);
                    hlImageLink.ToolTip     = String.Format(GetLocaleResourceString("Media.Category.ImageLinkTitleFormat"), category.Name);
                    hlImageLink.Text        = String.Format(GetLocaleResourceString("Media.Category.ImageAlternateTextFormat"), category.Name);
                }


                var hlCategory = e.Item.FindControl("hlCategory") as HyperLink;
                if (hlCategory != null)
                {
                    hlCategory.NavigateUrl = SEOHelper.GetCategoryUrl(category.CategoryId);
                    hlCategory.ToolTip     = String.Format(GetLocaleResourceString("Media.Category.ImageLinkTitleFormat"), category.Name);
                    hlCategory.Text        = Server.HtmlEncode(category.Name);
                }
            }
        }
Ejemplo n.º 2
0
        protected void CreateChildMenu(CategoryCollection breadCrumb, int rootCategoryId, Category currentCategory, int level)
        {
            int padding = level++ *15;

            foreach (var category in CategoryManager.GetAllCategories(rootCategoryId))
            {
                var link = new NopCommerceLi();
                phCategories.Controls.Add(link);

                string categoryURL = SEOHelper.GetCategoryUrl(category.CategoryId);
                if (currentCategory != null && currentCategory.CategoryId == category.CategoryId)
                {
                    link.CssClass = "active";
                }
                else
                {
                    link.CssClass = "inactive";
                }
                link.HyperLink.NavigateUrl = categoryURL;
                link.HyperLink.Text        = Server.HtmlEncode(category.Name);
                if (padding > 0)
                {
                    link.LiLeftMargin = padding.ToString();
                }

                for (int i = 0; i <= breadCrumb.Count - 1; i++)
                {
                    if (breadCrumb[i].CategoryId == category.CategoryId)
                    {
                        CreateChildMenu(breadCrumb, category.CategoryId, currentCategory, level);
                    }
                }
            }
        }
 protected void rptrSubCategories_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         var category   = e.Item.DataItem as Category;
         var hlCategory = e.Item.FindControl("hlCategory") as HyperLink;
         if (hlCategory != null)
         {
             hlCategory.NavigateUrl = SEOHelper.GetCategoryUrl(category.CategoryId);
         }
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (category == null || category.Deleted || !category.Published)
            {
                Response.Redirect(CommonHelper.GetStoreLocation());
            }

            //title, meta
            string title = string.Empty;

            if (!string.IsNullOrEmpty(category.LocalizedMetaTitle))
            {
                title = category.LocalizedMetaTitle;
            }
            else
            {
                title = category.LocalizedName;
            }
            SEOHelper.RenderTitle(this, title, true);
            SEOHelper.RenderMetaTag(this, "description", category.LocalizedMetaDescription, true);
            SEOHelper.RenderMetaTag(this, "keywords", category.LocalizedMetaKeywords, true);

            //canonical URL
            if (SEOHelper.EnableUrlRewriting &&
                this.SettingManager.GetSettingValueBoolean("SEO.CanonicalURLs.Category.Enabled"))
            {
                if (!this.SEName.Equals(SEOHelper.GetCategorySEName(category)))
                {
                    string canonicalUrl = SEOHelper.GetCategoryUrl(category);
                    if (this.Request.QueryString != null)
                    {
                        for (int i = 0; i < this.Request.QueryString.Count; i++)
                        {
                            string key = Request.QueryString.GetKey(i);
                            if (!String.IsNullOrEmpty(key) &&
                                (key.ToLowerInvariant() != "categoryid") &&
                                (key.ToLowerInvariant() != "sename"))
                            {
                                canonicalUrl = CommonHelper.ModifyQueryString(canonicalUrl, key + "=" + Request.QueryString[i], null);
                            }
                        }
                    }

                    SEOHelper.RenderCanonicalTag(Page, canonicalUrl);
                }
            }

            if (!Page.IsPostBack)
            {
                NopContext.Current.LastContinueShoppingPage = CommonHelper.GetThisPageUrl(true);
            }
        }
Ejemplo n.º 5
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //TODO: hard code catagory ID
         hplStringOrchestra.NavigateUrl       = SEOHelper.GetCategoryUrl(int.Parse(ConfigurationManager.AppSettings["CategoryStringOrchestra"].ToString()));
         hplFullOrchestra.NavigateUrl         = SEOHelper.GetCategoryUrl(int.Parse(ConfigurationManager.AppSettings["CatagoryFullOrchestra"].ToString()));
         hplBand.NavigateUrl                  = SEOHelper.GetCategoryUrl(int.Parse(ConfigurationManager.AppSettings["CatagoryBand"].ToString()));
         hplChoral_Vocal.NavigateUrl          = SEOHelper.GetCategoryUrl(int.Parse(ConfigurationManager.AppSettings["CatagoryChoral_Vocal"].ToString()));
         hplInstr_Solos_Ensembles.NavigateUrl = SEOHelper.GetCategoryUrl(int.Parse(ConfigurationManager.AppSettings["CatagoryInstrumentalSolos_Ensembles"].ToString()));
         hplPiano.NavigateUrl                 = SEOHelper.GetCategoryUrl(int.Parse(ConfigurationManager.AppSettings["CatagoryPiano"].ToString()));
     }
 }
Ejemplo n.º 6
0
 protected void rptrSubCategories_ItemDataBound(object sender, RepeaterItemEventArgs e)
 {
     if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
     {
         var category   = e.Item.DataItem as Category;
         var hlCategory = e.Item.FindControl("hlCategory") as HyperLink;
         if (hlCategory != null)
         {
             hlCategory.NavigateUrl = SEOHelper.GetCategoryUrl(category.CategoryId);
             hlCategory.ToolTip     = String.Format(GetLocaleResourceString("Media.Category.ImageLinkTitleFormat"), category.Name);
             hlCategory.Text        = Server.HtmlEncode(category.Name);
         }
     }
 }
Ejemplo n.º 7
0
        private void WriteCategories(int parentCategoryId)
        {
            var categories = CategoryManager.GetAllCategoriesByParentCategoryId(parentCategoryId, false);

            foreach (var category in categories)
            {
                var url             = SEOHelper.GetCategoryUrl(category);
                var updateFrequency = UpdateFrequency.Weekly;
                var updateTime      = category.UpdatedOn;
                WriteUrlLocation(url, updateFrequency, updateTime);

                WriteCategories(category.CategoryId);
            }
        }
Ejemplo n.º 8
0
        protected void dlCategories_ItemDataBound(object sender, DataListItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var category = e.Item.DataItem as Category;

                var hlLink = e.Item.FindControl("hlLink") as HyperLink;
                if (hlLink != null)
                {
                    hlLink.NavigateUrl = SEOHelper.GetCategoryUrl(category);
                    hlLink.Text        = Server.HtmlEncode(category.LocalizedName);
                }
            }
        }
Ejemplo n.º 9
0
 private void WriteCategories(StringBuilder sb, CategoryCollection categoryCollection)
 {
     foreach (Category category in categoryCollection)
     {
         sb.Append("<li>");
         sb.AppendFormat("<a href=\"{0}\">{1}</a>", SEOHelper.GetCategoryUrl(category.CategoryId), Server.HtmlEncode(category.Name));
         CategoryCollection childCategoryCollection = CategoryManager.GetAllCategories(category.CategoryId);
         if (childCategoryCollection.Count > 0)
         {
             sb.Append("<ul>");
             WriteCategories(sb, childCategoryCollection);
             sb.Append("</ul>");
         }
         sb.Append("</li>");
     }
 }
        protected void CreateChildMenu(List <Category> breadCrumb, int rootCategoryId, Category currentCategory, int level)
        {
            int padding = level++ *15;

            foreach (var category in this.CategoryService.GetAllCategoriesByParentCategoryId(rootCategoryId))
            {
                var link = new NopCommerceLi();
                phCategories.Controls.Add(link);

                string categoryURL = SEOHelper.GetCategoryUrl(category);
                if (currentCategory != null && currentCategory.CategoryId == category.CategoryId)
                {
                    link.CssClass = "active";
                }
                else
                {
                    link.CssClass = "inactive";
                }
                link.HyperLink.NavigateUrl = categoryURL;
                string catName = string.Empty;
                if (this.SettingManager.GetSettingValueBoolean("Display.Products.ShowCategoryProductNumber"))
                {
                    //display category name with assigned products number
                    int numberOfProducts = GetNumberOfProducts(category, this.SettingManager.GetSettingValueBoolean("Display.Products.ShowCategoryProductNumber.IncludeSubCategories"));
                    catName = string.Format("{0} ({1})", category.LocalizedName, numberOfProducts);
                }
                else
                {
                    //display only category name
                    catName = category.LocalizedName;
                }
                link.HyperLink.Text = Server.HtmlEncode(catName);
                if (padding > 0)
                {
                    link.LiLeftMargin = padding.ToString();
                }

                for (int i = 0; i <= breadCrumb.Count - 1; i++)
                {
                    if (breadCrumb[i].CategoryId == category.CategoryId)
                    {
                        CreateChildMenu(breadCrumb, category.CategoryId, currentCategory, level);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        protected override void OnLoad(EventArgs e)
        {
            var category = this.CategoryService.GetCategoryById(this.CategoryId);

            if (category != null)
            {
                PreviewButton.OnClientClick = string.Format("javascript:OpenWindow('{0}', 800, 600, true); return false;", SEOHelper.GetCategoryUrl(category.CategoryId));
            }
            else
            {
            }
            base.OnLoad(e);
        }
Ejemplo n.º 12
0
        protected override void OnPreRender(EventArgs e)
        {
            PreviewButton.OnClientClick = string.Format("javascript:OpenWindow('{0}', 800, 600, true); return false;", SEOHelper.GetCategoryUrl(this.CategoryId));

            base.OnPreRender(e);
        }