Skip to content

Commit dbbf915

Browse files
committed
Please execute "update-database -TargetMigration PictureSize"
1 parent 7518baf commit dbbf915

15 files changed

Lines changed: 178 additions & 205 deletions

src/Libraries/SmartStore.Core/Domain/Catalog/SpecificationAttribute.cs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System.Collections.Generic;
22
using SmartStore.Core.Domain.Localization;
33
using System.Runtime.Serialization;
4+
using SmartStore.Core.Search.Facets;
45

56
namespace SmartStore.Core.Domain.Catalog
67
{
@@ -30,9 +31,15 @@ public partial class SpecificationAttribute : BaseEntity, ILocalizedEntity
3031
[DataMember]
3132
public int DisplayOrder { get; set; }
3233

33-
/// <summary>
34-
/// Gets or sets the specification attribute options
35-
/// </summary>
34+
/// <summary>
35+
/// Gets or sets the sorting of facets. Only effective in accordance with MegaSearchPlus plugin.
36+
/// </summary>
37+
[DataMember]
38+
public FacetSorting FacetSorting { get; set; }
39+
40+
/// <summary>
41+
/// Gets or sets the specification attribute options
42+
/// </summary>
3643
[DataMember]
3744
public virtual ICollection<SpecificationAttributeOption> SpecificationAttributeOptions
3845
{

src/Libraries/SmartStore.Core/Search/Facets/FacetDescriptor.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ public enum ValueOperator
1717
Or
1818
}
1919

20-
public enum Sorting
21-
{
22-
HitsDesc,
23-
ValueAsc
24-
}
25-
2620
private readonly List<FacetValue> _values;
2721

2822
public FacetDescriptor(string key)
@@ -93,7 +87,7 @@ public int MaxChoicesCount
9387
/// <summary>
9488
/// Gets or sets the result choices sort order.
9589
/// </summary>
96-
public Sorting OrderBy
90+
public FacetSorting OrderBy
9791
{
9892
get;
9993
set;
@@ -118,13 +112,21 @@ public override string ToString()
118112
}
119113

120114

115+
public enum FacetSorting
116+
{
117+
HitsDesc,
118+
ValueAsc,
119+
DisplayOrder
120+
}
121+
122+
121123
public static class FacetDescriptorExtensions
122124
{
123-
public static IOrderedEnumerable<Facet> OrderBy(this IEnumerable<Facet> source, FacetDescriptor.Sorting sorting)
125+
public static IOrderedEnumerable<Facet> OrderBy(this IEnumerable<Facet> source, FacetSorting sorting)
124126
{
125127
Guard.NotNull(source, nameof(source));
126128

127-
if (sorting == FacetDescriptor.Sorting.HitsDesc)
129+
if (sorting == FacetSorting.HitsDesc)
128130
{
129131
return source.OrderByDescending(x => x.HitCount);
130132
}

src/Libraries/SmartStore.Core/Search/SearchSettings.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
using System.Collections.Generic;
22
using SmartStore.Core.Configuration;
3-
using SmartStore.Core.Search.Facets;
43

54
namespace SmartStore.Core.Search
65
{
@@ -16,7 +15,6 @@ public SearchSettings()
1615
InstantSearchTermMinLength = 2;
1716
FilterMinHitCount = 1;
1817
FilterMaxChoicesCount = 20;
19-
FilterOrderBy = FacetDescriptor.Sorting.HitsDesc;
2018
}
2119

2220
/// <summary>
@@ -64,11 +62,6 @@ public SearchSettings()
6462
/// </summary>
6563
public int FilterMaxChoicesCount { get; set; }
6664

67-
/// <summary>
68-
/// Gets or sets the filter value order
69-
/// </summary>
70-
public FacetDescriptor.Sorting FilterOrderBy { get; set; }
71-
7265
// TBD: what about area specific searchin setting (product, blog, etc.)
7366
}
7467
}

src/Libraries/SmartStore.Data/Mapping/Catalog/SpecificationAttributeMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public SpecificationAttributeMap()
1010
this.ToTable("SpecificationAttribute");
1111
this.HasKey(sa => sa.Id);
1212
this.Property(sa => sa.Name).IsRequired();
13-
this.Property(sa => sa.Alias).HasMaxLength(100);
13+
this.Property(sa => sa.Alias).HasMaxLength(30);
1414
}
1515
}
1616
}

src/Libraries/SmartStore.Data/Mapping/Catalog/SpecificationAttributeOptionMap.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public SpecificationAttributeOptionMap()
1010
this.ToTable("SpecificationAttributeOption");
1111
this.HasKey(sao => sao.Id);
1212
this.Property(sao => sao.Name).IsRequired();
13-
this.Property(sao => sao.Alias).HasMaxLength(100);
13+
this.Property(sao => sao.Alias).HasMaxLength(30);
1414

1515
this.HasRequired(sao => sao.SpecificationAttribute)
1616
.WithMany(sa => sa.SpecificationAttributeOptions)

src/Libraries/SmartStore.Data/Migrations/201701240959492_SpecificationAttributeAlias.resx

Lines changed: 0 additions & 126 deletions
This file was deleted.

src/Libraries/SmartStore.Data/Migrations/201701240959492_SpecificationAttributeAlias.Designer.cs renamed to src/Libraries/SmartStore.Data/Migrations/201701251835419_SpecificationAttributeAlias.Designer.cs

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Libraries/SmartStore.Data/Migrations/201701240959492_SpecificationAttributeAlias.cs renamed to src/Libraries/SmartStore.Data/Migrations/201701251835419_SpecificationAttributeAlias.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@ public partial class SpecificationAttributeAlias : DbMigration
77
{
88
public override void Up()
99
{
10-
AddColumn("dbo.SpecificationAttributeOption", "Alias", c => c.String(maxLength: 100));
11-
AddColumn("dbo.SpecificationAttribute", "Alias", c => c.String(maxLength: 100));
10+
AddColumn("dbo.SpecificationAttributeOption", "Alias", c => c.String(maxLength: 30));
11+
AddColumn("dbo.SpecificationAttribute", "Alias", c => c.String(maxLength: 30));
12+
AddColumn("dbo.SpecificationAttribute", "FacetSorting", c => c.Int(nullable: false));
1213
}
1314

1415
public override void Down()
1516
{
17+
DropColumn("dbo.SpecificationAttribute", "FacetSorting");
1618
DropColumn("dbo.SpecificationAttribute", "Alias");
1719
DropColumn("dbo.SpecificationAttributeOption", "Alias");
1820
}

src/Libraries/SmartStore.Data/Migrations/201701251835419_SpecificationAttributeAlias.resx

Lines changed: 126 additions & 0 deletions
Large diffs are not rendered by default.

src/Libraries/SmartStore.Data/Migrations/MigrationsConfiguration.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -371,20 +371,18 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
371371
"Specifies the maximum number of filters per group.",
372372
"Legt die maximale Anzahl an Filtern pro Gruppe fest.");
373373

374-
builder.AddOrUpdate("Admin.Configuration.Settings.Search.FilterOrderBy",
375-
"Sort filters",
376-
"Filter sortieren",
377-
"Specifies the sorting of filters.",
378-
"Legt die Sortierung von Filtern fest.");
379-
380-
builder.AddOrUpdate("Enums.SmartStore.Core.Search.Facets.FacetDescriptor.Sorting.HitsDesc",
374+
builder.AddOrUpdate("Enums.SmartStore.Core.Search.Facets.FacetSorting.HitsDesc",
381375
"Hit count: highest first",
382376
"Trefferanzahl: Höchste zuerst");
383377

384-
builder.AddOrUpdate("Enums.SmartStore.Core.Search.Facets.FacetDescriptor.Sorting.ValueAsc",
378+
builder.AddOrUpdate("Enums.SmartStore.Core.Search.Facets.FacetSorting.ValueAsc",
385379
"Name: A to Z",
386380
"Name: A bis Z");
387381

382+
builder.AddOrUpdate("Enums.SmartStore.Core.Search.Facets.FacetSorting.DisplayOrder",
383+
"According to display order",
384+
"Gemäß Reihenfolge");
385+
388386
builder.AddOrUpdate("Admin.Catalog.Attributes.SpecificationAttributes.Fields.Alias",
389387
"Alias",
390388
"Alias",

0 commit comments

Comments
 (0)