-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
Description
nopCommerce version: 4.50.1
Steps to reproduce the problem: Export all customers to excel in the admin area.
I need to have the clients subscribed to a store in the excel exported file. It is strange that this is present in the xml version but on the excel one.
I changed the source code by adding this function in ExportManager.cs (inside Nop.Services library):
async Task<object> getNewsLetterSubscription(Customer customer)
{
var stores = await _storeService.GetAllStoresAsync();
var subscriptions = "";
foreach(var store in stores)
{
var newsletter = await _newsLetterSubscriptionService.GetNewsLetterSubscriptionByEmailAndStoreIdAsync(customer.Email, stores.First().Id);
var subscribedToNewsletters = newsletter != null && newsletter.Active;
if(!string.IsNullOrWhiteSpace(subscriptions))
{
subscriptions += "; ";
}
subscriptions += $"{store.Name} - {subscribedToNewsletters}";
}
return subscriptions;
}
And the new property:
new PropertyByName<Customer>("NewsletterSubscription", getNewsLetterSubscription)
All stores are represented with a True False on one column instead of a separate column for each store. This is a temp fix but we should have the same behavior as the xml file. Is it possible ?