Skip to content

Commit eb55891

Browse files
committed
More export projection and projection field attribute filter
1 parent c01c0c8 commit eb55891

18 files changed

Lines changed: 798 additions & 281 deletions

File tree

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

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,23 @@ public enum ExportDeploymentType
1818
Http,
1919
Ftp
2020
}
21+
22+
public enum ExportDescriptionMergingType
23+
{
24+
None = 0,
25+
ShortDescriptionOrNameIfEmpty,
26+
ShortDescription,
27+
Description,
28+
NameAndShortDescription,
29+
NameAndDescription,
30+
ManufacturerAndNameAndShortDescription,
31+
ManufacturerAndNameAndDescription
32+
}
33+
34+
public enum ExportProjectionFieldType
35+
{
36+
Description = 0,
37+
Brand,
38+
PictureSize
39+
}
2140
}

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

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,18 @@
11
using System;
2+
using SmartStore.Core.Domain.Catalog;
23

34
namespace SmartStore.Core.Domain.DataExchange
45
{
56
[Serializable]
67
public class ExportProjection
78
{
9+
public ExportProjection()
10+
{
11+
RemoveCriticalCharacters = true;
12+
CriticalCharacters = "¼;½;¾";
13+
PriceType = PriceDisplayType.PreSelectedPrice;
14+
}
15+
816
/// <summary>
917
/// The language to be applied to the export
1018
/// </summary>
@@ -14,5 +22,23 @@ public class ExportProjection
1422
/// The currency to be applied to the export
1523
/// </summary>
1624
public int? CurrencyId { get; set; }
25+
26+
public int? CustomerId { get; set; }
27+
28+
public ExportDescriptionMergingType? DescriptionMerging { get; set; }
29+
30+
public bool DescriptionToPlainText { get; set; }
31+
32+
public string AppendDescriptionText { get; set; }
33+
34+
public bool RemoveCriticalCharacters { get; set; }
35+
36+
public string CriticalCharacters { get; set; }
37+
38+
public PriceDisplayType? PriceType { get; set; }
39+
40+
public bool ConvertNetToGrossPrices { get; set; }
41+
42+
public string Brand { get; set; }
1743
}
1844
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.Linq;
44
using System.Text;
55
using System.Threading.Tasks;
6+
using SmartStore.Core.Domain.DataExchange;
67

78
namespace SmartStore.Core.Plugins
89
{
@@ -67,6 +68,11 @@ public class ProviderMetadata
6768
/// </remarks>
6869
public bool IsEditable { get; set; }
6970

71+
/// <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
73+
/// </summary>
74+
public ExportProjectionFieldType[] ExportProjectionFields { get; set; }
75+
7076
/// <summary>
7177
/// Gets or sets an array of widget system names, which depend on the current provider
7278
/// </summary>

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

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
9898
builder.AddOrUpdate("Common.Projection", "Projection", "Projektion");
9999
builder.AddOrUpdate("Common.Deployment", "Deployment", "Bereitstellung");
100100
builder.AddOrUpdate("Common.Website", "Website", "Web-Seite");
101+
builder.AddOrUpdate("Common.DetailDescription", "Detail description", "Detailbeschreibung");
101102

102103
builder.AddOrUpdate("Admin.Validation.UsernamePassword", "Please enter username and password", "Bitte geben Sie Benutzername und Passwort ein");
103104
builder.AddOrUpdate("Admin.Validation.Url", "Please enter a valid URL", "Bitte geben Sie eine gültige URL ein");
@@ -336,12 +337,82 @@ public void MigrateLocaleResources(LocaleResourcesBuilder builder)
336337
"Specifies the currency to be applied to the export.",
337338
"Legt die auf den Export anzuwendende Währung fest.");
338339

340+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.CustomerId",
341+
"Customer ID",
342+
"Kunden-ID",
343+
"Specifies the ID of the customer to be applied to the export. Is taken into account for price calculations for example.",
344+
"Legt die ID des Kunden fest, auf den sich der Export beziehen soll. Wird z.B. bei Preisberechnungen berücksichtigt.");
345+
346+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.DescriptionMerging",
347+
"Product description",
348+
"Artikelbeschreibung",
349+
"Specifies what information to use for the description of the product.",
350+
"Legt fest, welche Informationen zur Beschreibung des Artikel wie verwendet werden sollen.");
351+
352+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.DescriptionToPlainText",
353+
"Remove HTML from description",
354+
"HTML aus der Beschreibung entfernen",
355+
"Specifies whether to remove all HTML from the product description for the export.",
356+
"Legt fest, ob für den Export alle HTML-Auszeichnungen aus der Artikelbeschreibung entfernt werden sollen.");
357+
358+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.AppendDescriptionText",
359+
"Text to be appended",
360+
"Anzuhängender Text",
361+
"Specifies the text to be attached to the product description. You can enter multiple, semicolon delimited texts. Then one of it is selected randomly.",
362+
"Legt den an die Artikelbeschreibung anzuhängenden Text fest. Es können auch mehrere, durch Semikolon getrennte Texte eingegeben werden. Dann wird per Zufall einer ausgewählt.");
363+
364+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.RemoveCriticalCharacters",
365+
"Remove critical characters",
366+
"Kritische Zeichen entfernen",
367+
"Specifies whether to remove critical characters (like ½) from the detail description.",
368+
"Legt fest, ob kritische Zeichen (wie z.B. ½) aus der Detailsbeschreibung entfernt werden sollen.");
369+
370+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.CriticalCharacters",
371+
"Critical characters",
372+
"Kritische Zeichen",
373+
"List with semicolon delimited characters to be removed from the detail description.",
374+
"Liste mit Semikolon getrennten Zeichen, die aus der Detailbeschreibung entfernt werden sollen.");
375+
376+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.PriceType",
377+
"Product price",
378+
"Produktpreis",
379+
"Specifies the product price to be exported.",
380+
"Legt den zu exportierenden Produktpreis fest.");
381+
382+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.ConvertNetToGrossPrices",
383+
"Convert net into gross prices",
384+
"Netto- in Bruttopreise umrechnen",
385+
"Specifies to convert net into gross prices.",
386+
"Legt fest, dass Netto- in Bruttopreise umgerechnet werden sollen.");
387+
388+
builder.AddOrUpdate("Admin.Configuration.Export.Projection.Brand",
389+
"Manufacturer\\Brand",
390+
"Hersteller\\Marke",
391+
"Specifies the manufacturer or brand to be exported, if a product has no manufacturer assigned.",
392+
"Legt den zu exportierenden Hersteller bzw. die Marke fest, wenn für ein Produkt kein Hersteller zugeordnet ist.");
339393

340394
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDeploymentType.FileSystem", "File system", "Dateisystem");
341395
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDeploymentType.Email", "Email", "E-Mail");
342396
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDeploymentType.Http", "HTTP", "HTTP");
343397
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDeploymentType.Ftp", "FTP", "FTP");
344398

399+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.None",
400+
"None", "Keine");
401+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.ShortDescriptionOrNameIfEmpty",
402+
"Short description or name if empty", "Kurzbeschreibung oder Name falls leer");
403+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.ShortDescription",
404+
"Short description", "Kurzbeschreibung");
405+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.Description",
406+
"Description", "Detailbeschreibung");
407+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.NameAndShortDescription",
408+
"Product name + short description", "Produktname + Kurzbeschreibung");
409+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.NameAndDescription",
410+
"Product name + long description", "Produktname + Detailbeschreibung");
411+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.ManufacturerAndNameAndShortDescription",
412+
"Manufacturer + Product name + short description", "Hersteller + Produktname + Kurzbeschreibung");
413+
builder.AddOrUpdate("Enums.SmartStore.Core.Domain.DataExchange.ExportDescriptionMergingType.ManufacturerAndNameAndDescription",
414+
"Manufacturer + Product name + long description", "Hersteller + Produktname + Detailbeschreibung");
415+
345416

346417
builder.AddOrUpdate("Admin.Configuration.Export.Deployment.Name",
347418
"Name",

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ public static ExpandoObject ToExpando(this Product product, int languageId, IPic
244244
dynamic exp = new ExpandoObject();
245245
exp.Id = x.Id;
246246
exp.DisplayOrder = x.DisplayOrder;
247-
exp.Picture = x.PictureId == 0 ? null : x.Picture.ToExpando(pictureService, store, mediaSettings.ProductThumbPictureSize, mediaSettings.ProductDetailsPictureSize);
247+
exp.Picture = x.Picture.ToExpando(pictureService, store, mediaSettings.ProductThumbPictureSize, mediaSettings.ProductDetailsPictureSize);
248248

249249
return exp as ExpandoObject;
250250
})
@@ -259,7 +259,7 @@ public static ExpandoObject ToExpando(this Product product, int languageId, IPic
259259
exp.Id = x.Id;
260260
exp.DisplayOrder = x.DisplayOrder;
261261
exp.IsFeaturedProduct = x.IsFeaturedProduct;
262-
exp.Manufacturer = x.ManufacturerId == 0 ? null : x.Manufacturer.ToExpando(languageId);
262+
exp.Manufacturer = x.Manufacturer.ToExpando(languageId);
263263

264264
return exp as ExpandoObject;
265265
})
@@ -274,7 +274,7 @@ public static ExpandoObject ToExpando(this Product product, int languageId, IPic
274274
exp.Id = x.Id;
275275
exp.DisplayOrder = x.DisplayOrder;
276276
exp.IsFeaturedProduct = x.IsFeaturedProduct;
277-
exp.Category = x.CategoryId == 0 ? null : x.Category.ToExpando(languageId);
277+
exp.Category = x.Category.ToExpando(languageId);
278278

279279
return exp as ExpandoObject;
280280
})
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using SmartStore.Core.Domain.DataExchange;
3+
4+
namespace SmartStore.Services.DataExchange
5+
{
6+
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
7+
public sealed class ExportProjectionFieldAttribute : Attribute
8+
{
9+
public ExportProjectionFieldAttribute(params ExportProjectionFieldType[] types)
10+
{
11+
Types = types;
12+
}
13+
14+
public ExportProjectionFieldType[] Types { get; set; }
15+
}
16+
}

0 commit comments

Comments
 (0)