stop purchase if subscription exists
stop purchase if subscription exists
What would be the best way to do this? We'd like to give the user a warning if they are attempting to purchase a subscription that they are already subscribed to. Thanks!
Re: stop purchase if subscription exists
You can place some alert on product details page for subscription item. For example following code checks on product detail that this item is been already subscribed or not and if its not expired then show the customer some text saying its been already subscribed.
Code: Select all
int productId = PageHelper.GetProductId();
foreach (Subscription subscription in Token.Instance.User.Subscriptions)
{
if (productId == subscription.ProductId && subscription.ExpirationDate > DateTime.Now)
Response.Write("Already purchased this subscription");
}