Skip to content

Commit

Permalink
Export: Projected customer id was ignored in price calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
mgesing committed Jul 13, 2016
1 parent d9455aa commit e6ef17b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -969,9 +969,12 @@ private List<Store> Init(DataExporterContext ctx, int? totalRecords = null)
ctx.ContextCurrency = _services.WorkContext.WorkingCurrency;

if (ctx.Projection.CustomerId.HasValue)
ctx.ContextCustomer = _customerService.GetCustomerById(ctx.Projection.CustomerId.Value);
else
ctx.ContextCustomer = _services.WorkContext.CurrentCustomer;
{
ctx.OldCurrentCustomer = _services.WorkContext.CurrentCustomer;
_services.WorkContext.CurrentCustomer = _customerService.GetCustomerById(ctx.Projection.CustomerId.Value);
}

ctx.ContextCustomer = _services.WorkContext.CurrentCustomer;

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

_exportProfileService.Value.UpdateExportProfile(ctx.Request.Profile);
}

if (ctx.OldCurrentCustomer != null)
{
_services.WorkContext.CurrentCustomer = ctx.OldCurrentCustomer;
}
}
catch (Exception exception)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ public bool Supports(ExportFeatures feature)
public ExportFilter Filter { get; private set; }
public ExportProjection Projection { get; private set; }
public Currency ContextCurrency { get; set; }
public Customer OldCurrentCustomer { get; set; }
public Customer ContextCustomer { get; set; }
public Language ContextLanguage { get; set; }

Expand Down

0 comments on commit e6ef17b

Please sign in to comment.