Skip to content

Commit 8a970ec

Browse files
committed
More export projection
1 parent eb55891 commit 8a970ec

17 files changed

Lines changed: 384 additions & 81 deletions

File tree

src/Libraries/SmartStore.Core/Domain/DataExchange/ExportCore.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public enum ExportDeploymentType
1919
Ftp
2020
}
2121

22-
public enum ExportDescriptionMergingType
22+
public enum ExportDescriptionMerging
2323
{
2424
None = 0,
2525
ShortDescriptionOrNameIfEmpty,
@@ -31,10 +31,15 @@ public enum ExportDescriptionMergingType
3131
ManufacturerAndNameAndDescription
3232
}
3333

34-
public enum ExportProjectionFieldType
34+
public enum ExportProjectionSupport
3535
{
3636
Description = 0,
3737
Brand,
38-
PictureSize
38+
MainPictureUrl,
39+
UseOwnProductNo,
40+
CategoryPath,
41+
ShippingTime,
42+
ShippingCosts,
43+
Availability
3944
}
4045
}

src/Libraries/SmartStore.Core/Domain/DataExchange/ExportFilter.cs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,6 @@ namespace SmartStore.Core.Domain.DataExchange
1010
[Serializable]
1111
public class ExportFilter
1212
{
13-
public ExportFilter()
14-
{
15-
IsPublished = true;
16-
}
17-
1813
/// <summary>
1914
/// Store identifier; 0 to load all records
2015
/// </summary>
@@ -32,6 +27,16 @@ public ExportFilter()
3227

3328
#region Product
3429

30+
/// <summary>
31+
/// Minimum product identifier
32+
/// </summary>
33+
public int? IdMinimum { get; set; }
34+
35+
/// <summary>
36+
/// Maximum product identifier
37+
/// </summary>
38+
public int? IdMaximum { get; set; }
39+
3540
/// <summary>
3641
/// Minimum price
3742
/// </summary>
@@ -55,7 +60,7 @@ public ExportFilter()
5560
/// <summary>
5661
/// A value indicating whether to load only published or non published products
5762
/// </summary>
58-
public bool IsPublished { get; set; }
63+
public bool? IsPublished { get; set; }
5964

6065
/// <summary>
6166
/// Category identifiers

src/Libraries/SmartStore.Core/Domain/DataExchange/ExportProjection.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ public ExportProjection()
1313
PriceType = PriceDisplayType.PreSelectedPrice;
1414
}
1515

16+
public int? StoreId { get; set; }
17+
1618
/// <summary>
1719
/// The language to be applied to the export
1820
/// </summary>
@@ -25,7 +27,7 @@ public ExportProjection()
2527

2628
public int? CustomerId { get; set; }
2729

28-
public ExportDescriptionMergingType? DescriptionMerging { get; set; }
30+
public ExportDescriptionMerging? DescriptionMerging { get; set; }
2931

3032
public bool DescriptionToPlainText { get; set; }
3133

@@ -40,5 +42,13 @@ public ExportProjection()
4042
public bool ConvertNetToGrossPrices { get; set; }
4143

4244
public string Brand { get; set; }
45+
46+
public int PictureSize { get; set; }
47+
48+
public string ShippingTime { get; set; }
49+
50+
public decimal? ShippingCosts { get; set; }
51+
52+
public decimal? FreeShippingThreshold { get; set; }
4353
}
4454
}

src/Libraries/SmartStore.Core/Plugins/Providers/ProviderMetadata.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,9 @@ public class ProviderMetadata
6969
public bool IsEditable { get; set; }
7070

7171
/// <summary>
72-
/// Gets or sets an array of field types that are supported by an export provider and thus should be editable on profile level
72+
/// Gets or sets an array of values that reflects what export projection is supported by a provider
7373
/// </summary>
74-
public ExportProjectionFieldType[] ExportProjectionFields { get; set; }
74+
public ExportProjectionSupport[] ExportProjectionSupport { get; set; }
7575

7676
/// <summary>
7777
/// Gets or sets an array of widget system names, which depend on the current provider

src/Libraries/SmartStore.Data/Migrations/201508091512101_ExportFramework.cs

Lines changed: 58 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ public void Seed(SmartObjectContext context)
8787
}, new string[] { SystemCustomerRoleNames.Administrators });
8888
}
8989

90+
private void RemoveStringResources(LocaleResourcesBuilder builder)
91+
{
92+
}
93+
9094
public void MigrateLocaleResources(LocaleResourcesBuilder builder)
9195
{
9296
builder.AddOrUpdate("Common.Enabled", "Enabled", "Aktiviert");
@@ -228,6 +232,18 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
228232
"Filter by created date.",
229233
"Nach dem Erstellungsdatum filtern.");
230234

235+
builder.AddOrUpdate("Admin.Configuration.Export.Filter.IdMinimum",
236+
"Product Id from",
237+
"Produkt-ID von",
238+
"Filter by product identifier.",
239+
"Nach der Produkt-ID filtern.");
240+
241+
builder.AddOrUpdate("Admin.Configuration.Export.Filter.IdMaximum",
242+
"Product Id to",
243+
"Produkt-ID bis",
244+
"Filter by product identifier.",
245+
"Nach der Produkt-ID filtern.");
246+
231247
builder.AddOrUpdate("Admin.Configuration.Export.Filter.PriceMinimum",
232248
"Price from",
233249
"Preis von",
@@ -325,6 +341,12 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
325341
"Nach Kundengruppen filtern.");
326342

327343

344+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.StoreId",
345+
"Store",
346+
"Shop",
347+
"Specifies the store to be applied to the export.",
348+
"Legt den auf den Export anzuwendenden Shop fest.");
349+
328350
builder.AddOrUpdate("Admin.Configuration.Export.Projection.LanguageId",
329351
"Language",
330352
"Sprache",
@@ -391,26 +413,51 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
391413
"Specifies the manufacturer or brand to be exported, if a product has no manufacturer assigned.",
392414
"Legt den zu exportierenden Hersteller bzw. die Marke fest, wenn für ein Produkt kein Hersteller zugeordnet ist.");
393415

416+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.PictureSize",
417+
"Product picture size",
418+
"Produktbildgröße",
419+
"Specifies the size (in pixel) of the product image.",
420+
"Legt die Größe (in Pixel) des Produktbildes fest.");
421+
422+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.ShippingTime",
423+
"Shipping time",
424+
"Lieferzeit",
425+
"Specifies the shipping time for products where it is unspecified.",
426+
"Legt die Lieferzeit für Produkte fest, wo diese nicht angegeben ist.");
427+
428+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.ShippingCosts",
429+
"Shipping costs",
430+
"Versandkosten",
431+
"The shipping costs to be exported.",
432+
"Die zu exportierenden Versandkosten.");
433+
434+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.FreeShippingThreshold",
435+
"Free shipping threshold",
436+
"Kostenloser Versand ab",
437+
"Specifies the amount as from shipping is free.",
438+
"Legt den Betrag fest, ab dem keine Versandkosten anfallen.");
439+
440+
394441
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDeploymentType.FileSystem", "File system", "Dateisystem");
395442
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDeploymentType.Email", "Email", "E-Mail");
396443
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDeploymentType.Http", "HTTP", "HTTP");
397444
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDeploymentType.Ftp", "FTP", "FTP");
398445

399-
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.None",
446+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMerging.None",
400447
"None", "Keine");
401-
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.ShortDescriptionOrNameIfEmpty",
448+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMerging.ShortDescriptionOrNameIfEmpty",
402449
"Short description or name if empty", "Kurzbeschreibung oder Name falls leer");
403-
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.ShortDescription",
450+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMerging.ShortDescription",
404451
"Short description", "Kurzbeschreibung");
405-
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.Description",
452+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMerging.Description",
406453
"Description", "Detailbeschreibung");
407-
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.NameAndShortDescription",
454+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMerging.NameAndShortDescription",
408455
"Product name + short description", "Produktname + Kurzbeschreibung");
409-
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.NameAndDescription",
456+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMerging.NameAndDescription",
410457
"Product name + long description", "Produktname + Detailbeschreibung");
411-
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.ManufacturerAndNameAndShortDescription",
458+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMerging.ManufacturerAndNameAndShortDescription",
412459
"Manufacturer + Product name + short description", "Hersteller + Produktname + Kurzbeschreibung");
413-
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.ManufacturerAndNameAndDescription",
460+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMerging.ManufacturerAndNameAndDescription",
414461
"Manufacturer + Product name + long description", "Hersteller + Produktname + Detailbeschreibung");
415462

416463

@@ -473,6 +520,9 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
473520
"E-Mail Konto",
474521
"Specifies the email account through which the data should be sent.",
475522
"Legt das E-Mail Konto fest, über welches die Daten verschickt werden sollen.");
523+
524+
525+
RemoveStringResources(builder);
476526
}
477527
}
478528
}

src/Libraries/SmartStore.Services/DataExchange/ExportAttributes.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
namespace SmartStore.Services.DataExchange
55
{
66
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
7-
public sealed class ExportProjectionFieldAttribute : Attribute
7+
public sealed class ExportProjectionSupportAttribute : Attribute
88
{
9-
public ExportProjectionFieldAttribute(params ExportProjectionFieldType[] types)
9+
public ExportProjectionSupportAttribute(params ExportProjectionSupport[] types)
1010
{
1111
Types = types;
1212
}
1313

14-
public ExportProjectionFieldType[] Types { get; set; }
14+
public ExportProjectionSupport[] Types { get; set; }
1515
}
1616
}

src/Libraries/SmartStore.Services/DataExchange/ExportExecuteContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public interface IExportExecuteContext
2222

2323
string FileNamePattern { get; }
2424

25+
object ConfigurationData { get; }
26+
2527
Dictionary<string, object> CustomProperties { get; set; }
2628

2729
string GetFilePath(string fileNameSuffix = null);
@@ -57,6 +59,8 @@ public bool IsCanceled
5759

5860
public string FileNamePattern { get; internal set; }
5961

62+
public object ConfigurationData { get; internal set; }
63+
6064
public Dictionary<string, object> CustomProperties { get; set; }
6165

6266
public string GetFilePath(string fileNameSuffix = null)

src/Libraries/SmartStore.Services/DataExchange/ExportExtensions.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
using SmartStore.Core.Plugins;
1+
using System.Linq;
2+
using SmartStore.Core.Domain.DataExchange;
3+
using SmartStore.Core.Plugins;
24

35
namespace SmartStore.Services.DataExchange
46
{
@@ -11,5 +13,12 @@ public static bool IsValid(this Provider<IExportProvider> provider)
1113
provider.Value.FileExtension.HasValue()
1214
);
1315
}
16+
17+
public static bool Supports(this Provider<IExportProvider> provider, ExportProjectionSupport type)
18+
{
19+
if (provider != null)
20+
return provider.Metadata.ExportProjectionSupport.Contains(type);
21+
return false;
22+
}
1423
}
1524
}

0 commit comments

Comments
 (0)