logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
mbartens26403835  
#1 Posted : Tuesday, August 22, 2023 1:44:28 PM(UTC)
mbartens26403835

Rank: Newbie

Groups: Registered, Developers
Joined: 8/11/2021(UTC)
Posts: 6

Thanks: 2 times
Hi,
I believe I've found an issue.
In the admin go to Manage --> Subscriptions and click on Plan Summary

When you click on the links for the Active, Inactive etc it takes you back to the Manage Subscriptions page but it does not filter by the Subscription plan

Please advice when this will be fixed as it is a requirement for my client.

Thank you

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

shaharyar  
#2 Posted : Wednesday, August 23, 2023 7:52:45 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Hi,

Thanks for pointing this out. I am able to reproduce the issue.

Hopefully, we can push this change in our upcoming release. The final release date is yet to be decided.

I can share the fix in this thread if you want to update the code.

mbartens26403835  
#3 Posted : Thursday, August 24, 2023 7:14:16 AM(UTC)
mbartens26403835

Rank: Newbie

Groups: Registered, Developers
Joined: 8/11/2021(UTC)
Posts: 6

Thanks: 2 times
Originally Posted by: shaharyar Go to Quoted Post
Hi,

Thanks for pointing this out. I am able to reproduce the issue.

Hopefully, we can push this change in our upcoming release. The final release date is yet to be decided.

I can share the fix in this thread if you want to update the code.




That would be great! Thank you
moizkiyani027991993  
#4 Posted : Thursday, August 24, 2023 10:15:39 AM(UTC)
moizkiyani027991993

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>





thanks 1 user thanked moizkiyani027991993 for this useful post.
mbartens26403835 on 9/5/2023(UTC)
mbartens26403835  
#5 Posted : Friday, August 25, 2023 9:33:08 AM(UTC)
mbartens26403835

Rank: Newbie

Groups: Registered, Developers
Joined: 8/11/2021(UTC)
Posts: 6

Thanks: 2 times
Thank you that works great! I did notice something else though. There is no start date being passed to the manage page so when you click on Expire within 7 you do not get the correct results.
Thank you
shaharyar  
#6 Posted : Friday, August 25, 2023 8:49:58 PM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Thank you.
We ll look into this and will update accordingly.
shaharyar  
#7 Posted : Friday, October 6, 2023 6:18:26 AM(UTC)
shaharyar

Rank: Advanced Member

Groups: Admin, Developers, Registered, HelpDesk, Authorized User
Joined: 10/5/2018(UTC)
Posts: 704

Thanks: 5 times
Was thanked: 113 time(s) in 112 post(s)
Quote:
There is no start date being passed to the manage page so when you click on Expire within 7 you do not get the correct results.


To fix this issue, please follow the steps:

1- Website\Areas\Admin\Controllers\SubscriptionsController.cs
2- Search for code
Code:
public ActionResult Index(int planId = 0, int Status = 0, string Exp = null)
{
    ManageSubscriptionsModel subscriptionModel = new ManageSubscriptionsModel();
    subscriptionModel.Plan = planId;
    subscriptionModel.Status = Status;
    subscriptionModel.Exp = Exp;
    Session["SubscriptionSearchCriteria"] = subscriptionModel;
    return View(subscriptionModel);
}


3- Replace with code

Code:
public ActionResult Index(int planId = 0, int Status = 0, string Exp = null)
{
    ManageSubscriptionsModel subscriptionModel = new ManageSubscriptionsModel();
    subscriptionModel.Plan = planId;
    subscriptionModel.Status = Status;
    subscriptionModel.Exp = Exp;
    if (!string.IsNullOrEmpty(Exp))
    {
        subscriptionModel.DateEnd = LocaleHelper.LocalNow.AddDays(Math.Abs(AlwaysConvert.ToInt(Exp))).ToString();
    }
    Session["SubscriptionSearchCriteria"] = subscriptionModel;
    return View(subscriptionModel);
}
thanks 1 user thanked shaharyar for this useful post.
mbartens26403835 on 10/9/2023(UTC)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.