Beispiel #1
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);
            }
        }