protected void Page_Load(object sender, EventArgs e)
        {
            if (manufacturer == null || manufacturer.Deleted || !manufacturer.Published)
            {
                Response.Redirect(CommonHelper.GetStoreLocation());
            }

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

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

            //canonical URL
            if (SEOHelper.EnableUrlRewriting &&
                this.SettingManager.GetSettingValueBoolean("SEO.CanonicalURLs.Manufacturer.Enabled"))
            {
                if (!this.SEName.Equals(SEOHelper.GetManufacturerSEName(manufacturer)))
                {
                    string canonicalUrl = SEOHelper.GetManufacturerUrl(manufacturer);
                    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() != "manufacturerid") &&
                                (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);
            }
        }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (product == null || product.Deleted)
            {
                Response.Redirect(CommonHelper.GetStoreLocation());
            }

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

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

            //canonical URL
            if (SEOHelper.EnableUrlRewriting &&
                this.SettingManager.GetSettingValueBoolean("SEO.CanonicalURLs.Products.Enabled"))
            {
                if (!this.SEName.Equals(SEOHelper.GetProductSEName(product)))
                {
                    string canonicalUrl = SEOHelper.GetProductUrl(product);

                    SEOHelper.RenderCanonicalTag(Page, canonicalUrl);
                }
            }

            if (!Page.IsPostBack)
            {
                this.ProductService.AddProductToRecentlyViewedList(product.ProductId);
            }
        }