From c26a9ce93edb4fd956295e189a22aa1953cd7f40 Mon Sep 17 00:00:00 2001 From: Marcus Gesing Date: Wed, 9 Mar 2016 10:58:58 +0100 Subject: [PATCH 01/49] Fixed #856 Return 404 only when topic is rendered as widget --- .../SmartStore.Web/Controllers/TopicController.cs | 5 +++-- src/Presentation/SmartStore.Web/Models/Topics/TopicModel.cs | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Presentation/SmartStore.Web/Controllers/TopicController.cs b/src/Presentation/SmartStore.Web/Controllers/TopicController.cs index 5821d1658f..7c4be750a3 100644 --- a/src/Presentation/SmartStore.Web/Controllers/TopicController.cs +++ b/src/Presentation/SmartStore.Web/Controllers/TopicController.cs @@ -66,7 +66,8 @@ protected TopicModel PrepareTopicModel(string systemName) MetaDescription = topic.GetLocalized(x => x.MetaDescription), MetaTitle = topic.GetLocalized(x => x.MetaTitle), TitleTag = titleTag, - }; + RenderAsWidget = topic.RenderAsWidget + }; return model; } @@ -79,7 +80,7 @@ public ActionResult TopicDetails(string systemName) var cacheKey = string.Format(ModelCacheEventConsumer.TOPIC_MODEL_KEY, systemName, _workContext.WorkingLanguage.Id, _storeContext.CurrentStore.Id); var cacheModel = _cacheManager.Get(cacheKey, () => PrepareTopicModel(systemName)); - if (cacheModel == null || !cacheModel.IncludeInSitemap) + if (cacheModel == null || (cacheModel.RenderAsWidget && !cacheModel.IncludeInSitemap)) return HttpNotFound(); return View("TopicDetails", cacheModel); diff --git a/src/Presentation/SmartStore.Web/Models/Topics/TopicModel.cs b/src/Presentation/SmartStore.Web/Models/Topics/TopicModel.cs index a2806157c9..96548a4559 100644 --- a/src/Presentation/SmartStore.Web/Models/Topics/TopicModel.cs +++ b/src/Presentation/SmartStore.Web/Models/Topics/TopicModel.cs @@ -21,5 +21,7 @@ public partial class TopicModel : EntityModelBase public string MetaTitle { get; set; } public string TitleTag { get; set; } - } + + public bool RenderAsWidget { get; set; } + } } \ No newline at end of file From d609477d04412eda23dd6c0864d7c423b3977f8e Mon Sep 17 00:00:00 2001 From: Christian Oliff Date: Thu, 31 Mar 2016 16:39:58 +0900 Subject: [PATCH 02/49] Fix 'occurred' typo Fix 'occurred' typo --- src/Presentation/SmartStore.Web/500.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Presentation/SmartStore.Web/500.html b/src/Presentation/SmartStore.Web/500.html index f9eaa260f1..741ebbcab5 100644 --- a/src/Presentation/SmartStore.Web/500.html +++ b/src/Presentation/SmartStore.Web/500.html @@ -41,7 +41,7 @@

- We apologize, an error ocurred while handling your request, this is not a problem with your computer or internet connection. + We apologize, an error occurred while handling your request, this is not a problem with your computer or internet connection. The details have been sent to our support team and we will investigate the issue very soon.

From 6b2501eaa824d7f4694ec96d8a79c3d92ec2ec9a Mon Sep 17 00:00:00 2001 From: Murat Cakir Date: Sat, 24 Jun 2017 03:32:45 +0200 Subject: [PATCH 03/49] 'Relaxed' MediaStorageData migration --- .../201608110948010_MediaStorageData.cs | 94 ++++++++++--------- .../Orders/CheckoutAttributeParser.cs | 37 -------- 2 files changed, 48 insertions(+), 83 deletions(-) diff --git a/src/Libraries/SmartStore.Data/Migrations/201608110948010_MediaStorageData.cs b/src/Libraries/SmartStore.Data/Migrations/201608110948010_MediaStorageData.cs index d17d600e81..e254602331 100644 --- a/src/Libraries/SmartStore.Data/Migrations/201608110948010_MediaStorageData.cs +++ b/src/Libraries/SmartStore.Data/Migrations/201608110948010_MediaStorageData.cs @@ -6,6 +6,7 @@ namespace SmartStore.Data.Migrations using System.IO; using System.Linq; using Core; + using Core.Data; using Core.Domain.Configuration; using Core.Domain.Media; using Core.Domain.Messages; @@ -14,37 +15,7 @@ namespace SmartStore.Data.Migrations public partial class MediaStorageData : DbMigration, ILocaleResourcesProvider, IDataSeeder { - private const int PAGE_SIZE = 1000; - - private void PageEntities( - SmartObjectContext context, - DbSet mediaStorages, - IOrderedQueryable query, - Action moveEntity) where TEntity : BaseEntity, IHasMedia - { - var pageIndex = 0; - IPagedList entities = null; - - do - { - if (entities != null) - { - // detach all entities from previous page to save memory - context.DetachAll(false); - entities.Clear(); - entities = null; - } - - // load max 1000 entities at once - entities = new PagedList(query, pageIndex++, PAGE_SIZE); - - entities.Each(x => moveEntity(x)); - - // save the current batch to database - context.SaveChanges(); - } - while (entities.HasNextPage); - } + private const int PAGE_SIZE = 200; private string GetFileName(int id, string extension, string mimeType) { @@ -118,12 +89,17 @@ public bool RollbackOnFailure public void Seed(SmartObjectContext context) { +#pragma warning disable 612, 618 context.MigrateLocaleResources(MigrateLocaleResources); var mediaStorages = context.Set(); var fileSystem = new LocalFileSystem(); + var mediaBasePath = $"Media\\{DataSettings.Current.TenantName}"; var storeMediaInDb = true; + fileSystem.TryCreateFolder(Path.Combine(mediaBasePath, "Downloads")); + fileSystem.TryCreateFolder(Path.Combine(mediaBasePath, "QueuedEmailAttachment")); + { var settings = context.Set(); @@ -153,14 +129,12 @@ public void Seed(SmartObjectContext context) { PageEntities(context, mediaStorages, context.Set().OrderBy(x => x.Id), picture => { -#pragma warning disable 612, 618 + if (picture.PictureBinary != null && picture.PictureBinary.LongLength > 0) { - var mediaStorage = new MediaStorage { Data = picture.PictureBinary }; - picture.MediaStorage = mediaStorage; + picture.MediaStorage = new MediaStorage { Data = picture.PictureBinary }; picture.PictureBinary = null; } -#pragma warning restore 612, 618 }); } @@ -170,28 +144,25 @@ public void Seed(SmartObjectContext context) PageEntities(context, mediaStorages, context.Set().OrderBy(x => x.Id), download => { -#pragma warning disable 612, 618 if (download.DownloadBinary != null && download.DownloadBinary.LongLength > 0) { if (storeMediaInDb) { // move binary data - var mediaStorage = new MediaStorage { Data = download.DownloadBinary }; - download.MediaStorage = mediaStorage; + download.MediaStorage = new MediaStorage { Data = download.DownloadBinary }; } else { // move to file system. it's necessary because from now on DownloadService depends on current storage provider - // and it would not find the binary data anymore if do not move it. + // and it would not find the binary data anymore if not moved. var fileName = GetFileName(download.Id, download.Extension, download.ContentType); - var path = fileSystem.Combine(@"Media\Downloads", fileName); + var path = fileSystem.Combine(fileSystem.Combine(mediaBasePath, "Downloads"), fileName); fileSystem.WriteAllBytes(path, download.DownloadBinary); } download.DownloadBinary = null; } -#pragma warning restore 612, 618 }); #endregion @@ -204,31 +175,62 @@ public void Seed(SmartObjectContext context) PageEntities(context, mediaStorages, attachmentQuery, attachment => { -#pragma warning disable 612, 618 if (attachment.Data != null && attachment.Data.LongLength > 0) { if (storeMediaInDb) { // move binary data - var mediaStorage = new MediaStorage { Data = attachment.Data }; - attachment.MediaStorage = mediaStorage; + attachment.MediaStorage = new MediaStorage { Data = attachment.Data }; } else { // move to file system. it's necessary because from now on QueuedEmailService depends on current storage provider // and it would not find the binary data anymore if do not move it. var fileName = GetFileName(attachment.Id, Path.GetExtension(attachment.Name.EmptyNull()), attachment.MimeType); - var path = fileSystem.Combine(@"Media\QueuedEmailAttachment", fileName); + var path = fileSystem.Combine(fileSystem.Combine(mediaBasePath, "QueuedEmailAttachment"), fileName); fileSystem.WriteAllBytes(path, attachment.Data); } attachment.Data = null; } -#pragma warning restore 612, 618 }); #endregion + +#pragma warning restore 612, 618 + } + + private void PageEntities( + SmartObjectContext context, + DbSet mediaStorages, + IOrderedQueryable query, + Action moveEntity) where TEntity : BaseEntity, IHasMedia + { + var pageIndex = 0; + IPagedList entities = null; + + do + { + if (entities != null) + { + // detach all entities from previous page to save memory + context.DetachAll(false); + entities.Clear(); + entities = null; + } + + GC.Collect(); + + // load max 1000 entities at once + entities = new PagedList(query, pageIndex++, PAGE_SIZE); + + entities.Each(x => moveEntity(x)); + + // save the current batch to database + context.SaveChanges(); + } + while (entities.HasNextPage); } public void MigrateLocaleResources(LocaleResourcesBuilder builder) diff --git a/src/Libraries/SmartStore.Services/Orders/CheckoutAttributeParser.cs b/src/Libraries/SmartStore.Services/Orders/CheckoutAttributeParser.cs index 213c1bd07c..8cb16e7959 100644 --- a/src/Libraries/SmartStore.Services/Orders/CheckoutAttributeParser.cs +++ b/src/Libraries/SmartStore.Services/Orders/CheckoutAttributeParser.cs @@ -6,9 +6,6 @@ namespace SmartStore.Services.Orders { - ///

- /// Checkout attribute parser - /// public partial class CheckoutAttributeParser : ICheckoutAttributeParser { private readonly ICheckoutAttributeService _checkoutAttributeService; @@ -18,11 +15,6 @@ public CheckoutAttributeParser(ICheckoutAttributeService checkoutAttributeServic this._checkoutAttributeService = checkoutAttributeService; } - /// - /// Gets selected checkout attribute identifiers - /// - /// Attributes - /// Selected checkout attribute identifiers public IList ParseCheckoutAttributeIds(string attributes) { var ids = new List(); @@ -55,11 +47,6 @@ public IList ParseCheckoutAttributeIds(string attributes) return ids; } - /// - /// Gets selected checkout attributes - /// - /// Attributes - /// Selected checkout attributes public IList ParseCheckoutAttributes(string attributes) { var caCollection = new List(); @@ -75,11 +62,6 @@ public IList ParseCheckoutAttributes(string attributes) return caCollection; } - /// - /// Get checkout attribute values - /// - /// Attributes - /// Checkout attribute values public IList ParseCheckoutAttributeValues(string attributes) { var caValues = new List(); @@ -107,12 +89,6 @@ public IList ParseCheckoutAttributeValues(string attribu return caValues; } - /// - /// Gets selected checkout attribute value - /// - /// Attributes - /// Checkout attribute identifier - /// Checkout attribute value public IList ParseValues(string attributes, int checkoutAttributeId) { var selectedCheckoutAttributeValues = new List(); @@ -155,13 +131,6 @@ public IList ParseValues(string attributes, int checkoutAttributeId) return selectedCheckoutAttributeValues; } - /// - /// Adds an attribute - /// - /// Attributes - /// Checkout attribute - /// Value - /// Attributes public string AddCheckoutAttribute(string attributes, CheckoutAttribute ca, string value) { string result = string.Empty; @@ -223,12 +192,6 @@ public string AddCheckoutAttribute(string attributes, CheckoutAttribute ca, stri return result; } - /// - /// Removes checkout attributes which cannot be applied to the current cart and returns an update attributes in XML format - /// - /// Attributes in XML format - /// Shopping cart items - /// Updated attributes in XML format public virtual string EnsureOnlyActiveAttributes(string attributes, IList cart) { if (String.IsNullOrEmpty(attributes)) From 0d3ebde54a2aecc128c162ffc6b16d4ab14120cb Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Mon, 3 Jul 2017 23:24:43 +0200 Subject: [PATCH 04/49] Added area parameter to action urls else the view couldn't be used by plugins --- .../Shared/Partials/Product.List.Item.Buttons.cshtml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Presentation/SmartStore.Web/Views/Shared/Partials/Product.List.Item.Buttons.cshtml b/src/Presentation/SmartStore.Web/Views/Shared/Partials/Product.List.Item.Buttons.cshtml index bdd6569d18..906a55c2ac 100644 --- a/src/Presentation/SmartStore.Web/Views/Shared/Partials/Product.List.Item.Buttons.cshtml +++ b/src/Presentation/SmartStore.Web/Views/Shared/Partials/Product.List.Item.Buttons.cshtml @@ -17,7 +17,7 @@ } if (!Model.Price.CallForPrice) { - var addToCartUrl = Url.Action("AddProductSimple", "ShoppingCart", new { productId = Model.Id, forceredirection = Model.Parent.ForceRedirectionAfterAddingToCart }); + var addToCartUrl = Url.Action("AddProductSimple", "ShoppingCart", new { productId = Model.Id, forceredirection = Model.Parent.ForceRedirectionAfterAddingToCart, area = "" }); var title = (Model.Price.AvailableForPreOrder ? T("ShoppingCart.PreOrder") : T("ShoppingCart.AddToCart")); Date: Sat, 22 Jul 2017 12:06:29 +0200 Subject: [PATCH 05/49] Fixes wrong date in several backend grids --- .../SmartStore.Web.Framework/Filters/JsonNetAttribute.cs | 6 ++++-- .../Modelling/Results/JsonNetResult.cs | 5 ++--- .../SmartStore.Web/Administration/Views/Log/List.cshtml | 9 ++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Presentation/SmartStore.Web.Framework/Filters/JsonNetAttribute.cs b/src/Presentation/SmartStore.Web.Framework/Filters/JsonNetAttribute.cs index 78d68534c3..1c706ee2f2 100644 --- a/src/Presentation/SmartStore.Web.Framework/Filters/JsonNetAttribute.cs +++ b/src/Presentation/SmartStore.Web.Framework/Filters/JsonNetAttribute.cs @@ -23,11 +23,11 @@ public void OnActionExecuted(ActionExecutedContext filterContext) if (filterContext == null || filterContext.HttpContext == null || filterContext.HttpContext.Request == null) return; - // don't apply filter to child methods + // Don't apply filter to child methods. if (filterContext.IsChildAction) return; - // handle JsonResult only + // Hndle JsonResult only. if (filterContext.Result.GetType() != typeof(JsonResult)) return; @@ -37,6 +37,8 @@ public void OnActionExecuted(ActionExecutedContext filterContext) MissingMemberHandling = MissingMemberHandling.Ignore, TypeNameHandling = TypeNameHandling.Objects, ReferenceLoopHandling = ReferenceLoopHandling.Ignore, + DateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind, + DateFormatHandling = DateFormatHandling.MicrosoftDateFormat, // We cannot ignore null. Client template of several Telerik grids would fail. //NullValueHandling = NullValueHandling.Ignore, diff --git a/src/Presentation/SmartStore.Web.Framework/Modelling/Results/JsonNetResult.cs b/src/Presentation/SmartStore.Web.Framework/Modelling/Results/JsonNetResult.cs index ddcfa3e716..d1478076e2 100644 --- a/src/Presentation/SmartStore.Web.Framework/Modelling/Results/JsonNetResult.cs +++ b/src/Presentation/SmartStore.Web.Framework/Modelling/Results/JsonNetResult.cs @@ -52,6 +52,8 @@ public override void ExecuteResult(ControllerContext context) TypeNameHandling = TypeNameHandling.Objects, ReferenceLoopHandling = ReferenceLoopHandling.Ignore, NullValueHandling = NullValueHandling.Ignore, + DateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind, + DateFormatHandling = DateFormatHandling.MicrosoftDateFormat, // Limit the object graph we'll consume to a fixed depth. This prevents stackoverflow exceptions // from deserialization errors that might occur from deeply nested objects. @@ -60,9 +62,6 @@ public override void ExecuteResult(ControllerContext context) if (_settings == null) { - serializerSettings.DateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind; - serializerSettings.DateFormatHandling = DateFormatHandling.MicrosoftDateFormat; - var utcDateTimeConverter = new UTCDateTimeConverter(_dateTimeHelper, new JavaScriptDateTimeConverter()); serializerSettings.Converters.Add(utcDateTimeConverter); } diff --git a/src/Presentation/SmartStore.Web/Administration/Views/Log/List.cshtml b/src/Presentation/SmartStore.Web/Administration/Views/Log/List.cshtml index 42a2a72a82..ce07e7cbfd 100644 --- a/src/Presentation/SmartStore.Web/Administration/Views/Log/List.cshtml +++ b/src/Presentation/SmartStore.Web/Administration/Views/Log/List.cshtml @@ -91,11 +91,12 @@ .HtmlAttributes(new { style = "text-align:center" }) .HeaderHtmlAttributes(new { style = "text-align:center" }); columns.Bound(x => x.Logger) - .Width(100) + .Width(120) .ClientTemplate("<#= LoggerShort #>"); columns.Bound(x => x.ShortMessage) .ClientTemplate("<#= LogLevel #>\"><#= ShortMessage #>"); - columns.Bound(x => x.UserName).Width(50); + columns.Bound(x => x.UserName) + .Width(120); columns.Bound(x => x.CreatedOn) .Width(160); }) @@ -154,7 +155,7 @@ $('.checkboxGroups').attr('checked', false).change(); selectedIds = []; }, - error:function (xhr, ajaxOptions, thrownError){ + error: function (xhr, ajaxOptions, thrownError){ alert(thrownError); }, traditional: true @@ -199,8 +200,6 @@ LogLevelId: $('#@Html.FieldIdFor(model => model.LogLevelId)').val() }; e.data = searchModel; - - console.log(searchModel); } From 6e394988eea7f9c6e36a0f1a054a03bcf1d775ac Mon Sep 17 00:00:00 2001 From: Michael Herzog Date: Mon, 18 Sep 2017 10:47:23 +0200 Subject: [PATCH 06/49] Reverted developer test code --- .../SmartStore.Web/Views/Catalog/ManufacturerAll.cshtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Presentation/SmartStore.Web/Views/Catalog/ManufacturerAll.cshtml b/src/Presentation/SmartStore.Web/Views/Catalog/ManufacturerAll.cshtml index c57d6f9e73..20d6072006 100644 --- a/src/Presentation/SmartStore.Web/Views/Catalog/ManufacturerAll.cshtml +++ b/src/Presentation/SmartStore.Web/Views/Catalog/ManufacturerAll.cshtml @@ -23,7 +23,7 @@ @{ Html.RenderWidget("manufacturers_all_top"); } - @if (true /* catalogSettings.SortManufacturersAlphabetically*/) + @if (catalogSettings.SortManufacturersAlphabetically) {