Rank: Newbie
Groups: Admin, HelpDesk, Developers, Registered Joined: 3/31/2023(UTC) Posts: 3
Was thanked: 1 time(s) in 1 post(s)
|
To resolve this issue you have to follow the given steps 1. Open file CommerceBuilder/Orders/SubscriptionRepository.cs 2. Search for Code line# 206: Code:.Add(Restrictions.Eq("OI.Product.Id", subscriptionPlanId));
3. Replace with Code: Code:.Add(Restrictions.Eq("SP.Id", subscriptionPlanId));
4. Open file Website/Areas/Admin/Controllers/SubscriptionsController.cs 5. Search for Code line# 751: Code:public ActionResult PlanSummary()
{
var SubscriptionPlans = _subscriptionPlanRepo.LoadAll();
var ListModel = SubscriptionPlans.Select(plan => new SubscriptionPlanModel()
{
Name = plan.Name,
ProductId = plan.Product.Id,
CountActive = CountSubscriptions(plan, BitFieldState.True),
CountInactive = CountSubscriptions(plan, BitFieldState.False),
CountAll = CountSubscriptions(plan, BitFieldState.Any),
ExpireIn0 = CountExpiringSubscriptions(plan, 0),
ExpireIn7 = CountExpiringSubscriptions(plan, 7),
ExpireIn30 = CountExpiringSubscriptions(plan, 30),
}).ToList();
return View(ListModel);
}
protected int CountSubscriptions(object dataItem, BitFieldState active)
{
SubscriptionPlan subscriptionPlan = (SubscriptionPlan)dataItem;
return _subscriptionRepo.SearchCount(subscriptionPlan.Product.Id, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.MinValue, DateTime.MaxValue, active);
}
protected int CountExpiringSubscriptions(Object dataItem, int expDays)
{
SubscriptionPlan subscriptionPlan = (SubscriptionPlan)dataItem;
DateTime expDateEnd = GetEndOfDay(LocaleHelper.LocalNow.AddDays(expDays));
return _subscriptionRepo.SearchCount(subscriptionPlan.Product.Id, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.MinValue, expDateEnd, BitFieldState.Any);
}
6. Replace with Code: Code:public ActionResult PlanSummary()
{
var SubscriptionPlans = _subscriptionPlanRepo.LoadAll();
var ListModel = SubscriptionPlans.Select(plan => new SubscriptionPlanModel()
{
Name = plan.Name,
ProductId = plan.Product.Id,
PlanId = plan.Id,
CountActive = CountSubscriptions(plan, BitFieldState.True),
CountInactive = CountSubscriptions(plan, BitFieldState.False),
CountAll = CountSubscriptions(plan, BitFieldState.Any),
ExpireIn0 = CountExpiringSubscriptions(plan, 0),
ExpireIn7 = CountExpiringSubscriptions(plan, 7),
ExpireIn30 = CountExpiringSubscriptions(plan, 30),
}).ToList();
return View(ListModel);
}
protected int CountSubscriptions(object dataItem, BitFieldState active)
{
SubscriptionPlan subscriptionPlan = (SubscriptionPlan)dataItem;
return _subscriptionRepo.SearchCount(subscriptionPlan.Id, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.MinValue, DateTime.MaxValue, active);
}
protected int CountExpiringSubscriptions(Object dataItem, int expDays)
{
SubscriptionPlan subscriptionPlan = (SubscriptionPlan)dataItem;
DateTime expDateEnd = GetEndOfDay(LocaleHelper.LocalNow.AddDays(expDays));
return _subscriptionRepo.SearchCount(subscriptionPlan.Id, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, DateTime.MinValue, expDateEnd, BitFieldState.Any);
}
7. Open a file Website/Areas/Admin/Models/SubscriptionModel.cs 8. Add this code after line# 112 Code:public int PlanId { get; set; }
9. Open a file Website/Areas/Admin/Views/Subscriptions/Index.cshtml 10. Find the code at line# 18 Code:@Html.Action("ListSubscriptions")
11. Replace it with code Code:@Html.Action("ListSubscriptions", new { modelData = Model })
12. Open a file Website/Areas/Admin/Views/Subscriptions/PlanSummary.cshtml 13. Find a code at line# 41 Code:<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.ProductId, Status = 1 })">@plan.CountActive</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.ProductId, Status = 2 })">@plan.CountInactive</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.ProductId, Status = 0 })">@plan.CountAll</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.ProductId, Exp = 0 })">@plan.ExpireIn0</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.ProductId, Exp = 7})">@plan.ExpireIn7</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.ProductId, Exp = 30})">@plan.ExpireIn30</a></td>
14. Replace it with code Code:<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.PlanId, Status = 1 })">@plan.CountActive</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.PlanId, Status = 2 })">@plan.CountInactive</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.PlanId, Status = 0 })">@plan.CountAll</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.PlanId, Exp = 0 })">@plan.ExpireIn0</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.PlanId, Exp = 7})">@plan.ExpireIn7</a></td>
<td class="text-center"><a href="@Url.Action("Index", new { planId = plan.PlanId, Exp = 30})">@plan.ExpireIn30</a></td>
|