Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add newsletter subscription data to Excel export #7488

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions src/Libraries/Nop.Services/ExportImport/ExportManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,8 @@ async Task<object> getStateProvince(Customer customer)

return stateProvince?.Name ?? string.Empty;
}

// Fetch all stores from the service
var stores = await _storeService.GetAllStoresAsync();
//property manager
var manager = new PropertyManager<Customer, Language>(new[]
{
Expand Down Expand Up @@ -2111,7 +2112,18 @@ async Task<object> getStateProvince(Customer customer)

}, !_securitySettings.AllowStoreOwnerExportImportCustomersWithHashedPassword),

}, _catalogSettings);
}
.Concat(
// Add newsletter subscription properties for each store dynamically
stores.Select(store => new PropertyByName<Customer, Language>(
$"Newsletter-in-store-{store.Id}",
async (customer, lang) =>
{
var newsletter = await _newsLetterSubscriptionService.GetNewsLetterSubscriptionByEmailAndStoreIdAsync(customer.Email, store.Id);
return (newsletter != null && newsletter.Active).ToString();
}
))
), _catalogSettings);

//activity log
await _customerActivityService.InsertActivityAsync("ExportCustomers",
Expand Down