Hi!
I have created a new custom rule for abandoned cart, but there is a problem, it doesnt send e-mails or add entries to reminder's report. I have other rules working fine, just it doesnt work. Better, can you verify my code, please?
When deguggig, there is data and result contains all message info to send, but after method return, nothing happens. I have changed all rule conditions, but no results anyway.
var customerReminderInfos = new List<CustomerReminderInfo>();
var _from = DateTime.Now.AddMinutes((int)conditionMetDateLaterThan.TotalMinutes * -1);
var _to = DateTime.Now.AddMinutes((int)conditionMetDataEarlierThan.TotalMinutes * -1);
var query = from sci in _sciRepository.Table
where sci.UpdatedOnUtc >= _from
&& sci.UpdatedOnUtc <= _to
&& sci.ShoppingCartTypeId == 1
&& sci.StoreId == storeId
select sci;
var cartItems = query.ToList();
var customers = cartItems.Select(p => p.Customer).Distinct().ToList();
foreach (var customer in customers)
{
if (!customer.IsRegistered())
continue;
var tokens = GetTokens(customer, store);
var customerReminderInfo = new CustomerReminderInfo()
{
Customer = customer,
ReminderMessageId = customer.Id,
RuleConditionMetDate = DateTime.Now,
Tokens = tokens,
StoreId = storeId
};
customerReminderInfos.Add(customerReminderInfo);
}
return customerReminderInfos;
Thanks!