Exemplo n.º 1
0
        private CheckoutViewModel PaymentErrorSetup()
        {
            ViewBag.Title     = "Checkout Payment Error";
            ViewBag.BodyClass = "store-checkout-page";

            CheckoutViewModel model = new CheckoutViewModel();

            LoadPendingOrder(model);

            // Buttons
            ThemeManager themes = MTApp.ThemeManager();

            model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection);
            model.ButtonCancelUrl   = themes.ButtonUrl("Cancel", Request.IsSecureConnection);

            // Populate Countries
            model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries();
            model.PaymentViewModel.AcceptedCardTypes = MTApp.CurrentStore.Settings.PaymentAcceptedCards;

            // Render Side Column
            var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn();

            model.SideColumn = columnRender.RenderColumnToString("601", MTApp, ViewBag);

            ViewData["PassedAnalyticsTop"] += "<script type=\"text/javascript\" src=\"" + Url.Content("~/js/checkout.js") + "\" ></script>";
            return(model);
        }
        public ActionResult Index(string id)
        {
            // TODO: This should be replaced by a direct render call like the tag handler version. 
            // eventually, there should not be controllers or methods for content blocks
            if (string.IsNullOrEmpty(id)) return Content("");

            var renderer = new code.TemplateEngine.TagHandlers.ContentColumn();
            string output = renderer.RenderColumnToString(id, MTApp, this.ViewBag);

            return Content(output);                        
        }
        //
        // GET: /CustomPage/
        public ActionResult Index(string slug)
        {
            ViewBag.BodyClass = "store-category-page";

            Category cat = MTApp.CatalogServices.Categories.FindBySlugForStore(slug, 
                                        MTApp.CurrentRequestContext.CurrentStore.Id);
            if (cat == null) cat = new Category();
            MTApp.CurrentRequestContext.CurrentCategory = cat;

            ViewBag.Title = cat.MetaTitle;
            if (String.IsNullOrEmpty(ViewBag.Title)) { ViewBag.Title = cat.Name; }
            ViewBag.MetaKeywords = cat.MetaKeywords;
            ViewBag.MetaDescription = cat.MetaDescription;

            // Record View for Analytics
            RecordCategoryView(cat.Bvin);
            
            // Get page.html Template
            ThemeManager tm = MTApp.ThemeManager();
            if (cat.TemplateName == string.Empty) { cat.TemplateName = "default.html"; }
            string template = tm.GetTemplateFromCurrentTheme(true, cat.TemplateName, "default.html"); // Try default in theme before system

            // Fill with data from category, making sure legacy description is used if no area data
            CategoryPageVersion version = cat.GetCurrentVersion();
            if (version.Id == 0)
            {
                // Create Initial Version
                version.PublishedStatus = PublishStatus.Draft;
                version.PageId = cat.Bvin;
                cat.Versions.Add(version);
                MTApp.CatalogServices.Categories.Update(cat);
                version = cat.GetCurrentVersion();
            }
            if (!version.Areas.HasArea("main"))
            {
                version.Areas.SetAreaContent("main", cat.PreTransformDescription);
            }

            ITagProvider tagProvider = new TagProvider();
            Processor proc = new Processor(this.MTApp, this.ViewBag, template, tagProvider);

            // Render Bread Crumbs
            var breadRender = new code.TemplateEngine.TagHandlers.BreadCrumbs();
            ViewBag.BreadCrumbsFinal = breadRender.RenderCategory(MTApp, new List<BreadCrumbItem>(), cat);

            var columnRenderer = new code.TemplateEngine.TagHandlers.ContentColumn();
            ViewBag.SideColumn = columnRenderer.RenderColumnToString("4", MTApp, ViewBag);

            StringBuilder output = new StringBuilder();
            proc.RenderForDisplay(output);
            return Content(output.ToString());            
        }
        public ActionResult Index(string id)
        {
            // TODO: This should be replaced by a direct render call like the tag handler version.
            // eventually, there should not be controllers or methods for content blocks
            if (string.IsNullOrEmpty(id))
            {
                return(Content(""));
            }

            var    renderer = new code.TemplateEngine.TagHandlers.ContentColumn();
            string output   = renderer.RenderColumnToString(id, MTApp, this.ViewBag);

            return(Content(output));
        }
Exemplo n.º 5
0
        private CheckoutViewModel IndexSetup()
        {
            ViewBag.Title     = "Checkout";
            ViewBag.BodyClass = "store-checkout-page";

            CheckoutViewModel model = new CheckoutViewModel();

            LoadOrder(model);
            CheckForPoints(model);

            // Buttons
            ThemeManager themes = MTApp.ThemeManager();

            model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection);
            model.ButtonLoginUrl    = MTApp.ThemeManager().ButtonUrl("Login", Request.IsSecureConnection);

            // Labels
            model.LabelRewardPoints = MTApp.CurrentStore.Settings.RewardsPointsName;

            // Agree Checkbox
            if (MTApp.CurrentStore.Settings.ForceTermsAgreement)
            {
                model.ShowAgreeToTerms         = true;
                model.AgreedToTerms            = false;
                model.AgreedToTermsDescription = SiteTerms.GetTerm(SiteTermIds.TermsAndConditionsAgreement);
                model.LabelTerms = SiteTerms.GetTerm(SiteTermIds.TermsAndConditions);
            }
            else
            {
                model.ShowAgreeToTerms = false;
                model.AgreedToTerms    = true;
            }

            // Populate Countries
            model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries();
            model.PaymentViewModel.AcceptedCardTypes = MTApp.CurrentStore.Settings.PaymentAcceptedCards;

            ViewData["PassedAnalyticsTop"] += "<script type=\"text/javascript\" src=\"" + Url.Content("~/js/checkout.js") + "\" ></script>";

            // Render Side Column
            var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn();

            model.SideColumn = columnRender.RenderColumnToString("601", MTApp, ViewBag);

            return(model);
        }
Exemplo n.º 6
0
        private CheckoutViewModel IndexSetup()
        {
            ViewBag.Title = "Checkout";
            ViewBag.BodyClass = "store-checkout-page";

            CheckoutViewModel model = new CheckoutViewModel();
            LoadOrder(model);
            CheckForPoints(model);

            // Buttons
            ThemeManager themes = MTApp.ThemeManager();
            model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection);
            model.ButtonLoginUrl = MTApp.ThemeManager().ButtonUrl("Login", Request.IsSecureConnection);

            // Labels
            model.LabelRewardPoints = MTApp.CurrentStore.Settings.RewardsPointsName;

            // Agree Checkbox
            if (MTApp.CurrentStore.Settings.ForceTermsAgreement)
            {
                model.ShowAgreeToTerms = true;
                model.AgreedToTerms = false;
                model.AgreedToTermsDescription = SiteTerms.GetTerm(SiteTermIds.TermsAndConditionsAgreement);
                model.LabelTerms = SiteTerms.GetTerm(SiteTermIds.TermsAndConditions);                                
            }
            else
            {
                model.ShowAgreeToTerms = false;
                model.AgreedToTerms = true;
            }

            // Populate Countries
            model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries();
            model.PaymentViewModel.AcceptedCardTypes = MTApp.CurrentStore.Settings.PaymentAcceptedCards;
            
            ViewData["AnalyticsTop"] += "<script type=\"text/javascript\" src=\"" + Url.Content("~/js/checkout.js") + "\" ></script>";

            // Render Side Column
            var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn();
            model.SideColumn = columnRender.RenderColumnToString("601", MTApp, ViewBag);

            return model;
        }
Exemplo n.º 7
0
        private CheckoutViewModel IndexSetup()
        {
            ViewBag.Title     = "Checkout";
            ViewBag.BodyClass = "store-checkout-page";

            CheckoutViewModel model = new CheckoutViewModel();

            model.CurrentOrder = SessionManager.CurrentShoppingCart(MTApp.OrderServices, MTApp.CurrentStore);

            // Buttons
            ThemeManager themes = MTApp.ThemeManager();

            model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection);
            model.ButtonCancelUrl   = themes.ButtonUrl("keepshopping", Request.IsSecureConnection);
            model.ButtonLoginUrl    = themes.ButtonUrl("edit", Request.IsSecureConnection);

            // Agree Checkbox
            if (MTApp.CurrentStore.Settings.ForceTermsAgreement)
            {
                model.ShowAgreeToTerms         = true;
                model.AgreedToTerms            = false;
                model.AgreedToTermsDescription = SiteTerms.GetTerm(SiteTermIds.TermsAndConditionsAgreement);
                model.LabelTerms = SiteTerms.GetTerm(SiteTermIds.TermsAndConditions);
            }
            else
            {
                model.ShowAgreeToTerms = false;
                model.AgreedToTerms    = true;
            }

            // Populate Countries
            model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries();

            // Side Column
            var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn();

            model.SideColumn = columnRender.RenderColumnToString("601", MTApp, ViewBag);

            return(model);
        }
        private CheckoutViewModel IndexSetup()
        {
            ViewBag.Title = "Checkout";
            ViewBag.BodyClass = "store-checkout-page";

            CheckoutViewModel model = new CheckoutViewModel();
            model.CurrentOrder = SessionManager.CurrentShoppingCart(MTApp.OrderServices, MTApp.CurrentStore);

            // Buttons
            ThemeManager themes = MTApp.ThemeManager();
            model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection);            
            model.ButtonCancelUrl = themes.ButtonUrl("keepshopping", Request.IsSecureConnection);
            model.ButtonLoginUrl = themes.ButtonUrl("edit", Request.IsSecureConnection);

            // Agree Checkbox
            if (MTApp.CurrentStore.Settings.ForceTermsAgreement)
            {
                model.ShowAgreeToTerms = true;
                model.AgreedToTerms = false;
                model.AgreedToTermsDescription = SiteTerms.GetTerm(SiteTermIds.TermsAndConditionsAgreement);
                model.LabelTerms = SiteTerms.GetTerm(SiteTermIds.TermsAndConditions);
            }
            else
            {
                model.ShowAgreeToTerms = false;
                model.AgreedToTerms = true;
            }

            // Populate Countries
            model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries();

            // Side Column
            var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn();
            model.SideColumn = columnRender.RenderColumnToString("601", MTApp, ViewBag);

            return model;
        }        
Exemplo n.º 9
0
        private ProductPageViewModel IndexSetup(string slug)
        {
            ViewBag.BodyClass = "store-product-page";
            ProductPageViewModel model = new ProductPageViewModel();

            model.LocalProduct = ParseProductFromSlug(slug);
            RenderOptionsJavascript(model);


            // Page Title
            ViewBag.Title = model.LocalProduct.MetaTitle.Trim();
            if (model.LocalProduct.MetaTitle.Trim().Length > 0)
            {
                ViewBag.Title = model.LocalProduct.MetaTitle;
            }
            else
            {
                ViewBag.Title = model.LocalProduct.ProductName;
            }

            // Meta Keywords
            ViewBag.MetaKeywords = model.LocalProduct.MetaKeywords.Trim();
            if (model.LocalProduct.MetaKeywords.Trim().Length > 0)
            {
                ViewBag.MetaKeywords = model.LocalProduct.MetaKeywords;
            }

            // Meta Description
            ViewBag.MetaDescription = model.LocalProduct.MetaDescription.Trim();
            if (model.LocalProduct.MetaDescription.Trim().Length > 0)
            {
                ViewBag.MetaDescription = model.LocalProduct.MetaDescription;
            }


            ViewBag.RelatedItemsTitle  = SiteTerms.GetTerm(SiteTermIds.RelatedItems);
            ViewBag.AddToCartButtonUrl = MTApp.ThemeManager().ButtonUrl("addtocart", Request.IsSecureConnection);
            ViewBag.SubmitButtonUrl    = MTApp.ThemeManager().ButtonUrl("submit", Request.IsSecureConnection);
            ViewBag.SaveLaterButton    = MTApp.ThemeManager().ButtonUrl("SaveForLater", Request.IsSecureConnection);

            CheckForBackOrder(model);

            // Allow custom image names instead of the auto-generated ones
            string imageName = model.LocalProduct.ImageFileMedium;

            if (imageName.Trim().Length < 3)
            {
                imageName = model.LocalProduct.ImageFileSmall;
            }
            model.MainImageUrl     = MerchantTribe.Commerce.Storage.DiskStorage.ProductImageUrlMedium(MTApp, model.LocalProduct.Bvin, imageName, Request.IsSecureConnection);
            model.MainImageAltText = model.LocalProduct.ImageFileMediumAlternateText;
            if (model.MainImageAltText.Trim().Length < 1)
            {
                model.MainImageAltText = model.LocalProduct.ImageFileSmallAlternateText;
            }
            model.PreRenderedTypeValues = model.LocalProduct.GetTypeProperties(this.MTApp);

            // Prices
            RenderPrices(model);

            LoadRelatedItems(model);
            RenderAdditionalImages(model);

            if (Request.QueryString["LineItemId"] != null)
            {
                model.OrderId    = Request.QueryString["OrderBvin"];
                model.LineItemId = Request.QueryString["LineItemId"];
            }

            if (SessionManager.IsUserAuthenticated(MTApp))
            {
                model.IsAvailableForWishList = true;
            }


            StringBuilder sb = new StringBuilder();

            sb.Append("<script src=\"" + Url.Content("~/scripts/tabs.js") + "\" type=\"text/javascript\"></script>");
            sb.Append("<script src=\"" + Url.Content("~/scripts/ProductPage.js") + "\" type=\"text/javascript\"></script>");
            sb.Append(model.JavaScripts);

            if (ViewBag.UseFaceBook == true)
            {
                sb.Append("<!-- FaceBook OpenGraph Tags -->");
                sb.Append("<meta property=\"og:title\" content=\"" + ViewBag.Title + "\"/>");
                sb.Append("<meta property=\"og:type\" content=\"product\"/>");
                sb.Append("<meta property=\"og:url\" content=\"" + ViewBag.CurrentUrl + "\"/>");
                sb.Append("<meta property=\"og:image\" content=\"" + model.MainImageUrl + "\"/>");
                sb.Append("<meta property=\"og:site_name\" content=\"" + ViewBag.StoreName + "\" />");
                sb.Append("<meta property=\"fb:admins\" content=\"" + ViewBag.FaceBookAdmins + "\" />");
                sb.Append("<meta property=\"fb:app_id\" content=\"" + ViewBag.FaceBookAppId + "\" />");
            }
            ViewData["AnalyticsTop"] += sb.ToString();

            StringBuilder sbb = new StringBuilder();

            sbb.Append("<div id=\"fb-root\"></div>");
            sbb.Append("<script>    (function (d, s, id) {");
            sbb.Append("var js, fjs = d.getElementsByTagName(s)[0];");
            sbb.Append("if (d.getElementById(id)) { return; }");
            sbb.Append("js = d.createElement(s); js.id = id;");
            sbb.Append("js.src = \"//connect.facebook.net/en_US/all.js#xfbml=1\";");
            sbb.Append("fjs.parentNode.insertBefore(js, fjs);");
            sbb.Append("} (document, 'script', 'facebook-jssdk'));</script>");

            ViewData["AnalyticsBottom"] += sbb.ToString();

            // Bread Crumbs
            var breadRender = new code.TemplateEngine.TagHandlers.BreadCrumbs();

            model.BreadCrumbsFinal = breadRender.RenderProduct(MTApp, new List <BreadCrumbItem>(), model.LocalProduct);

            // Columns
            var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn();

            model.PreColumn  = columnRender.RenderColumnToString(model.LocalProduct.PreContentColumnId, MTApp, ViewBag);
            model.PostColumn = columnRender.RenderColumnToString(model.LocalProduct.PostContentColumnId, MTApp, ViewBag);

            model.SwatchHtml = MerchantTribe.Commerce.Utilities.ImageHelper.GenerateSwatchHtmlForProduct(model.LocalProduct, this.MTApp);


            MTApp.CurrentRequestContext.CurrentProduct = model.LocalProduct;
            return(model);
        }
Exemplo n.º 10
0
        private CheckoutViewModel PaymentErrorSetup()
        {
            ViewBag.Title = "Checkout Payment Error";
            ViewBag.BodyClass = "store-checkout-page";

            CheckoutViewModel model = new CheckoutViewModel();
            LoadPendingOrder(model);

            // Buttons
            ThemeManager themes = MTApp.ThemeManager();
            model.ButtonCheckoutUrl = themes.ButtonUrl("PlaceOrder", Request.IsSecureConnection);
            model.ButtonCancelUrl = themes.ButtonUrl("Cancel", Request.IsSecureConnection);

            // Populate Countries
            model.Countries = MTApp.CurrentStore.Settings.FindActiveCountries();
            model.PaymentViewModel.AcceptedCardTypes = MTApp.CurrentStore.Settings.PaymentAcceptedCards;

            // Render Side Column
            var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn();
            model.SideColumn = columnRender.RenderColumnToString("601", MTApp, ViewBag);

            ViewData["AnalyticsTop"] += "<script type=\"text/javascript\" src=\"" + Url.Content("~/js/checkout.js") + "\" ></script>";
            return model;
        }
Exemplo n.º 11
0
        //
        // GET: /CustomPage/
        public ActionResult Index(string slug)
        {
            Category cat = MTApp.CatalogServices.Categories.FindBySlugForStore(slug,
                                                                               MTApp.CurrentRequestContext.CurrentStore.Id);

            if (cat == null)
            {
                cat = new Category();
            }
            MTApp.CurrentRequestContext.CurrentCategory = cat;

            ViewBag.Title = cat.MetaTitle;
            if (String.IsNullOrEmpty(ViewBag.Title))
            {
                ViewBag.Title = cat.Name;
            }
            ViewBag.MetaKeywords    = cat.MetaKeywords;
            ViewBag.MetaDescription = cat.MetaDescription;

            // Record View for Analytics
            RecordCategoryView(cat.Bvin);

            // Get page.html Template
            ThemeManager tm = MTApp.ThemeManager();

            if (cat.TemplateName == string.Empty)
            {
                cat.TemplateName = "default.html";
            }
            string template = tm.GetTemplateFromCurrentTheme(cat.TemplateName, "default.html"); // Try default in theme before system

            // Fill with data from category, making sure legacy description is used if no area data
            CategoryPageVersion version = cat.GetCurrentVersion();

            if (version.Id == 0)
            {
                // Create Initial Version
                version.PublishedStatus = PublishStatus.Draft;
                version.PageId          = cat.Bvin;
                cat.Versions.Add(version);
                MTApp.CatalogServices.Categories.Update(cat);
                version = cat.GetCurrentVersion();
            }
            if (!version.Areas.HasArea("main"))
            {
                version.Areas.SetAreaContent("main", cat.PreTransformDescription);
            }

            ITagProvider tagProvider = new TagProvider();
            Processor    proc        = new Processor(this.MTApp, this.ViewBag, template, tagProvider);

            // Render Bread Crumbs
            var breadRender = new code.TemplateEngine.TagHandlers.BreadCrumbs();

            ViewBag.BreadCrumbsFinal = breadRender.RenderCategory(MTApp, new List <BreadCrumbItem>(), cat);

            var columnRenderer = new code.TemplateEngine.TagHandlers.ContentColumn();

            ViewBag.SideColumn = columnRenderer.RenderColumnToString("4", MTApp, ViewBag);

            StringBuilder output = new StringBuilder();

            proc.RenderForDisplay(output);
            return(Content(output.ToString()));
        }
Exemplo n.º 12
0
        private ProductPageViewModel IndexSetup(string slug)
        {
            ViewBag.BodyClass = "store-product-page";
            ProductPageViewModel model = new ProductPageViewModel();
            model.LocalProduct = ParseProductFromSlug(slug);
            RenderOptionsJavascript(model);


            // Page Title
            ViewBag.Title = model.LocalProduct.MetaTitle.Trim();
            if (model.LocalProduct.MetaTitle.Trim().Length > 0)
            {                
                ViewBag.Title = model.LocalProduct.MetaTitle;
            }
            else
            {             
                ViewBag.Title = model.LocalProduct.ProductName;
            }

            // Meta Keywords
            ViewBag.MetaKeywords = model.LocalProduct.MetaKeywords.Trim();
            if (model.LocalProduct.MetaKeywords.Trim().Length > 0)
            {             
                ViewBag.MetaKeywords = model.LocalProduct.MetaKeywords;
            }

            // Meta Description
            ViewBag.MetaDescription = model.LocalProduct.MetaDescription.Trim();
            if (model.LocalProduct.MetaDescription.Trim().Length > 0)
            {             
                ViewBag.MetaDescription = model.LocalProduct.MetaDescription;
            }
            

            ViewBag.RelatedItemsTitle = SiteTerms.GetTerm(SiteTermIds.RelatedItems);
            ViewBag.AddToCartButtonUrl = MTApp.ThemeManager().ButtonUrl("addtocart", Request.IsSecureConnection);
            ViewBag.SubmitButtonUrl = MTApp.ThemeManager().ButtonUrl("submit", Request.IsSecureConnection);
            ViewBag.SaveLaterButton = MTApp.ThemeManager().ButtonUrl("SaveForLater", Request.IsSecureConnection);

            CheckForBackOrder(model);

            // Allow custom image names instead of the auto-generated ones
            string imageName = model.LocalProduct.ImageFileMedium;
            if (imageName.Trim().Length < 3)
            {
                imageName = model.LocalProduct.ImageFileSmall;
            }
            model.MainImageUrl = MerchantTribe.Commerce.Storage.DiskStorage.ProductImageUrlMedium(MTApp, model.LocalProduct.Bvin, imageName, Request.IsSecureConnection);
            model.MainImageAltText = model.LocalProduct.ImageFileMediumAlternateText;
            if (model.MainImageAltText.Trim().Length < 1) model.MainImageAltText = model.LocalProduct.ImageFileSmallAlternateText;
            model.PreRenderedTypeValues = model.LocalProduct.GetTypeProperties(this.MTApp);

            // Prices                        
            RenderPrices(model);

            LoadRelatedItems(model);
            RenderAdditionalImages(model);

            if (Request.QueryString["LineItemId"] != null)
            {
                model.OrderId = Request.QueryString["OrderBvin"];
                model.LineItemId = Request.QueryString["LineItemId"];
            }

            if (SessionManager.IsUserAuthenticated(MTApp))
            {
                model.IsAvailableForWishList = true;
            }


            StringBuilder sb = new StringBuilder();

            sb.Append("<script src=\"" + Url.Content("~/scripts/tabs.js") + "\" type=\"text/javascript\"></script>");
            sb.Append("<script src=\"" + Url.Content("~/scripts/ProductPage.js") + "\" type=\"text/javascript\"></script>");
            sb.Append(model.JavaScripts);

            if (ViewBag.UseFaceBook == true)
            {
                sb.Append("<!-- FaceBook OpenGraph Tags -->");
                sb.Append("<meta property=\"og:title\" content=\"" + ViewBag.Title + "\"/>");
                sb.Append("<meta property=\"og:type\" content=\"product\"/>");
                sb.Append("<meta property=\"og:url\" content=\"" + ViewBag.CurrentUrl + "\"/>");
                sb.Append("<meta property=\"og:image\" content=\"" + model.MainImageUrl + "\"/>");
                sb.Append("<meta property=\"og:site_name\" content=\"" + ViewBag.StoreName + "\" />");
                sb.Append("<meta property=\"fb:admins\" content=\"" + ViewBag.FaceBookAdmins + "\" />");
                sb.Append("<meta property=\"fb:app_id\" content=\"" + ViewBag.FaceBookAppId + "\" />");
            }
            ViewData["AnalyticsTop"] += sb.ToString();

            StringBuilder sbb = new StringBuilder();
            sbb.Append("<div id=\"fb-root\"></div>");
            sbb.Append("<script>    (function (d, s, id) {");
            sbb.Append("var js, fjs = d.getElementsByTagName(s)[0];");
            sbb.Append("if (d.getElementById(id)) { return; }");
            sbb.Append("js = d.createElement(s); js.id = id;");
            sbb.Append("js.src = \"//connect.facebook.net/en_US/all.js#xfbml=1\";");
            sbb.Append("fjs.parentNode.insertBefore(js, fjs);");
            sbb.Append("} (document, 'script', 'facebook-jssdk'));</script>");

            ViewData["AnalyticsBottom"] += sbb.ToString();

            // Bread Crumbs
            var breadRender = new code.TemplateEngine.TagHandlers.BreadCrumbs();
            model.BreadCrumbsFinal = breadRender.RenderProduct(MTApp, new List<BreadCrumbItem>(), model.LocalProduct);

            // Columns
            var columnRender = new code.TemplateEngine.TagHandlers.ContentColumn();
            model.PreColumn = columnRender.RenderColumnToString(model.LocalProduct.PreContentColumnId, MTApp, ViewBag);
            model.PostColumn = columnRender.RenderColumnToString(model.LocalProduct.PostContentColumnId, MTApp, ViewBag);

            model.SwatchHtml = MerchantTribe.Commerce.Utilities.ImageHelper.GenerateSwatchHtmlForProduct(model.LocalProduct, this.MTApp);
        

            MTApp.CurrentRequestContext.CurrentProduct = model.LocalProduct;
            return model;
        }