private static string ResolveUrl(string raw, MerchantTribeApplication app) { // full url string tester = raw.Trim().ToLowerInvariant(); if (tester.StartsWith("http:") || tester.StartsWith("https:") || tester.StartsWith("//")) { return(raw); } // tag replaced url {{img}} or {{assets} if (tester.StartsWith("{{")) { return(TagReplacer.ReplaceContentTags(raw, app, "")); } // app relative url if (tester.StartsWith("~")) { return(app.CurrentRequestContext.UrlHelper.Content(raw)); } // old style theme asset return(MerchantTribe.Commerce.Storage.DiskStorage.AssetUrl( app, app.CurrentStore.Settings.ThemeId, raw, app.IsCurrentRequestSecure())); }
private string ResolveSpecialUrl(string raw) { // full url var tester = raw.Trim().ToLowerInvariant(); if (tester.StartsWith("http:") || tester.StartsWith("https:") || tester.StartsWith("//")) { return(raw); } // tag replaced url {{img}} or {{assets} if (tester.StartsWith("{{")) { return(TagReplacer.ReplaceContentTags(raw, HccApp)); } // app relative url if (tester.StartsWith("~")) { return(ResolveUrl(raw)); } // old style asset return(DiskStorage.StoreUrl( HccApp, raw, HccApp.IsCurrentRequestSecure())); }
public string Render(MerchantTribe.Commerce.MerchantTribeApplication app, dynamic viewBag, MerchantTribe.Commerce.Content.ContentBlock block) { string result = string.Empty; if (block != null) { result = block.BaseSettings.GetSettingOrEmpty("HtmlData"); } result = TagReplacer.ReplaceContentTags(result, app, ""); return(result); }
public ActionResult Index(ContentBlock block) { var result = string.Empty; if (block != null) { result = block.TextSettings.GetSettingOrEmpty("HtmlData"); } result = TagReplacer.ReplaceContentTags(result, HccApp); return(Content(result)); }
// // GET: /ContentBlocks/Html/ public ActionResult Index(ContentBlock block) { string result = string.Empty; if (block != null) { result = block.BaseSettings.GetSettingOrEmpty("HtmlData"); } result = TagReplacer.ReplaceContentTags(result, MTApp, "", Request.IsSecureConnection); return(Content(result)); }
public string Render(MerchantTribe.Commerce.MerchantTribeApplication app, dynamic viewBag, MerchantTribe.Commerce.Content.ContentBlock block) { BannerAdViewModel model = new BannerAdViewModel(); if (block != null) { model.ImageUrl = block.BaseSettings.GetSettingOrEmpty("imageurl"); model.AltText = block.BaseSettings.GetSettingOrEmpty("alttext"); model.CssId = block.BaseSettings.GetSettingOrEmpty("cssid"); model.CssClass = block.BaseSettings.GetSettingOrEmpty("cssclass"); model.LinkUrl = block.BaseSettings.GetSettingOrEmpty("linkurl"); model.ImageUrl = TagReplacer.ReplaceContentTags(model.ImageUrl, app, ""); //model.ImageUrl; } return(RenderModel(model)); }
// // GET: /ContentBlocks/BannerAd/ public ActionResult Index(ContentBlock block) { BannerAdViewModel model = new BannerAdViewModel(); if (block != null) { model.ImageUrl = block.BaseSettings.GetSettingOrEmpty("imageurl"); model.AltText = block.BaseSettings.GetSettingOrEmpty("alttext"); model.CssId = block.BaseSettings.GetSettingOrEmpty("cssid"); model.CssClass = block.BaseSettings.GetSettingOrEmpty("cssclass"); model.LinkUrl = block.BaseSettings.GetSettingOrEmpty("linkurl"); model.ImageUrl = TagReplacer.ReplaceContentTags(model.ImageUrl, MTApp, "", Request.IsSecureConnection); } return(View(model)); }
private void SetViewBugs(Category cat) { ViewBag.DisplayHtml = TagReplacer.ReplaceContentTags(cat.Description, HccApp); ViewBag.LinkUrl = BuildUrlForCategory(cat, null, null); // Banner if (cat.BannerImageUrl.Trim().Length > 0) { ViewBag.ShowBanner = true; ViewBag.BannerUrl = DiskStorage.CategoryBannerUrl( HccApp, cat.Bvin, cat.BannerImageUrl, Request.IsSecureConnection); ViewBag.ImageUrl = DiskStorage.CategoryIconUrl(HccApp, cat.Bvin, cat.ImageUrl, Request.IsSecureConnection); } else { ViewBag.ShowBanner = false; } }
public ActionResult DrillDownIndex(string slug) { ViewBag.BodyClass = "store-categorydrilldown-page"; Category cat = MTApp.CatalogServices.Categories.FindBySlugForStore(slug, MTApp.CurrentRequestContext.CurrentStore.Id); if (cat == null) { cat = new Category(); } ViewBag.Title = cat.MetaTitle; if (String.IsNullOrEmpty(ViewBag.Title)) { ViewBag.Title = cat.Name; } ViewBag.MetaKeywords = cat.MetaKeywords; ViewBag.MetaDescription = cat.MetaDescription; ViewBag.DisplayHtml = TagReplacer.ReplaceContentTags(cat.Description, this.MTApp, "", Request.IsSecureConnection); string key = Request.QueryString["node"] ?? string.Empty; if (key == "-") { key = string.Empty; } ViewBag.Key = key; int pageNumber = GetPageNumber(); int pageSize = 9; int totalItems = 0; CategoryPageViewModel model = new CategoryPageViewModel(); CategoryFacetManager manager = CategoryFacetManager.InstantiateForDatabase(MTApp.CurrentRequestContext); List <CategoryFacet> facets = manager.FindByCategory(cat.Bvin); List <ProductProperty> properties = LoadProperties(facets); if (key == string.Empty) { key = CategoryFacetKeyHelper.BuildEmptyKey(facets.Count); } List <long> parsedKey = CategoryFacetKeyHelper.ParseKeyToList(key); List <Product> products = MTApp.CatalogServices.FindProductsMatchingKey(key, pageNumber, pageSize, ref totalItems); List <ProductFacetCount> productCounts = manager.FindCountsOfVisibleFacets(key, facets, properties); List <long> visibleIds = manager.FindVisibleFacetsIdsForKey(key, facets); model.Products = PrepProducts(products); model.LocalCategory = cat; model.PagerData.PageSize = pageSize; model.PagerData.TotalItems = totalItems; model.PagerData.CurrentPage = pageNumber; model.PagerData.PagerUrlFormat = UrlRewriter.BuildUrlForCategory(new CategorySnapshot(cat), MTApp.CurrentRequestContext.RoutingContext, "{0}"); model.PagerData.PagerUrlFormatFirst = UrlRewriter.BuildUrlForCategory(new CategorySnapshot(cat), MTApp.CurrentRequestContext.RoutingContext); model.SubCategories = PrepSubCategories(MTApp.CatalogServices.Categories.FindVisibleChildren(cat.Bvin)); StringBuilder sbNotSelected = new StringBuilder(); List <BreadCrumbItem> extraCrumbs = new List <BreadCrumbItem>(); for (int i = 0; i < facets.Count; i++) { if (visibleIds.Contains(facets[i].Id)) { // Find the property that matches the facet var p = (from pr in properties where pr.Id == facets[i].PropertyId select pr).SingleOrDefault(); if (p != null) { if (parsedKey[i] < 1) { // not selected this.RenderNonSelection(sbNotSelected, i, parsedKey[i], key, facets[i], p, productCounts, model); } else { // selected this.RenderSelection(sbNotSelected, i, parsedKey[i], key, facets[i], p, facets, model, extraCrumbs); } } } } ViewBag.ExtraCrumbs = extraCrumbs; ViewBag.Filters = sbNotSelected.ToString(); // Banner if (cat.BannerImageUrl.Trim().Length > 0) { ViewBag.ShowBanner = true; ViewBag.BannerUrl = MerchantTribe.Commerce.Storage.DiskStorage.CategoryBannerUrl( MTApp, cat.Bvin, cat.BannerImageUrl, Request.IsSecureConnection); } else { ViewBag.ShowBanner = false; } // Record Category View MerchantTribe.Commerce.SessionManager.CategoryLastId = cat.Bvin; return(View("DrillDown", model)); }
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(); } ViewBag.Title = cat.MetaTitle; if (String.IsNullOrEmpty(ViewBag.Title)) { ViewBag.Title = cat.Name; } ViewBag.MetaKeywords = cat.MetaKeywords; ViewBag.MetaDescription = cat.MetaDescription; ViewBag.DisplayHtml = TagReplacer.ReplaceContentTags(cat.Description, this.MTApp, "", Request.IsSecureConnection); ViewBag.AddToCartButton = this.MTApp.ThemeManager().ButtonUrl("AddToCart", Request.IsSecureConnection); ViewBag.DetailsButton = this.MTApp.ThemeManager().ButtonUrl("View", Request.IsSecureConnection); int pageNumber = GetPageNumber(); int pageSize = 9; int totalItems = 0; CategoryPageViewModel model = new CategoryPageViewModel(); List <Product> products = MTApp.CatalogServices.FindProductForCategoryWithSort( cat.Bvin, CategorySortOrder.ManualOrder, false, pageNumber, pageSize, ref totalItems); model.Products = PrepProducts(products); model.LocalCategory = cat; model.PagerData.PageSize = pageSize; model.PagerData.TotalItems = totalItems; model.PagerData.CurrentPage = pageNumber; model.PagerData.PagerUrlFormat = UrlRewriter.BuildUrlForCategory(new CategorySnapshot(cat), MTApp.CurrentRequestContext.RoutingContext, "{0}"); model.PagerData.PagerUrlFormatFirst = UrlRewriter.BuildUrlForCategory(new CategorySnapshot(cat), MTApp.CurrentRequestContext.RoutingContext); model.SubCategories = PrepSubCategories(MTApp.CatalogServices.Categories.FindVisibleChildren(cat.Bvin)); // Banner if (cat.BannerImageUrl.Trim().Length > 0) { ViewBag.ShowBanner = true; ViewBag.BannerUrl = MerchantTribe.Commerce.Storage.DiskStorage.CategoryBannerUrl( MTApp, cat.Bvin, cat.BannerImageUrl, Request.IsSecureConnection); } else { ViewBag.ShowBanner = false; } // Record Category View MerchantTribe.Commerce.SessionManager.CategoryLastId = cat.Bvin; MTApp.CurrentRequestContext.CurrentCategory = cat; if (cat.TemplateName == "BV Grid") { cat.TemplateName = "Grid"; // Safety Check from older versions } string viewName = cat.TemplateName.Trim(); return(View(viewName, model)); }