Skip to content

Commit e6ef17b

Browse files
committed
Export: Projected customer id was ignored in price calculation
1 parent d9455aa commit e6ef17b

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/Libraries/SmartStore.Services/DataExchange/Export/DataExporter.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -969,9 +969,12 @@ private List<Store> Init(DataExporterContext ctx, int? totalRecords = null)
969969
ctx.ContextCurrency = _services.WorkContext.WorkingCurrency;
970970

971971
if (ctx.Projection.CustomerId.HasValue)
972-
ctx.ContextCustomer = _customerService.GetCustomerById(ctx.Projection.CustomerId.Value);
973-
else
974-
ctx.ContextCustomer = _services.WorkContext.CurrentCustomer;
972+
{
973+
ctx.OldCurrentCustomer = _services.WorkContext.CurrentCustomer;
974+
_services.WorkContext.CurrentCustomer = _customerService.GetCustomerById(ctx.Projection.CustomerId.Value);
975+
}
976+
977+
ctx.ContextCustomer = _services.WorkContext.CurrentCustomer;
975978

976979
if (ctx.Projection.LanguageId.HasValue)
977980
ctx.ContextLanguage = _languageService.Value.GetLanguageById(ctx.Projection.LanguageId.Value);
@@ -1286,6 +1289,11 @@ private void ExportCoreOuter(DataExporterContext ctx)
12861289

12871290
_exportProfileService.Value.UpdateExportProfile(ctx.Request.Profile);
12881291
}
1292+
1293+
if (ctx.OldCurrentCustomer != null)
1294+
{
1295+
_services.WorkContext.CurrentCustomer = ctx.OldCurrentCustomer;
1296+
}
12891297
}
12901298
catch (Exception exception)
12911299
{

src/Libraries/SmartStore.Services/DataExchange/Export/Internal/DataExporterContext.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ public bool Supports(ExportFeatures feature)
8989
public ExportFilter Filter { get; private set; }
9090
public ExportProjection Projection { get; private set; }
9191
public Currency ContextCurrency { get; set; }
92+
public Customer OldCurrentCustomer { get; set; }
9293
public Customer ContextCustomer { get; set; }
9394
public Language ContextLanguage { get; set; }
9495

0 commit comments

Comments
 (0)