Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 2 of 2

Thread: Multiple subscriptions needed... but how?

  1. #1
    bdamore is offline Member
    Join Date
    Jun 2011
    Posts
    52

    Default Multiple subscriptions needed... but how?

    I realize that multiple subscriptions are not possible currently.

    How else would I go about this, though?

    Really don't want separate logins per subscription. Is there another way to handle this? (maybe having a custom ASPX page that somehow differentiates?)

    Would I have to setup two regular products and check the [AuthorizedOn]/(Purchase date) column with a custom "subscriptions.ASPX page" to check if the product...( 'subscription' so-to-speak ) is still valid ?

  2. #2
    bdamore is offline Member
    Join Date
    Jun 2011
    Posts
    52

    Default Completed:

    Hello,
    I got this to work, but it's a little tricky. Here's how it goes.

    Custom ‘Multiple Subscription’ Modification

    Description:

    The code below allows for the ability to have multiple ‘subscriptions’ using topic/product combinations by modifying driver.aspx.cs.




    Constraints:
    - Must create matching topic/product pair to work correctly.
    - Product Name/topic name must have ‘eBook’ in the name
    - ‘topic title’ and ‘product name’ must exactly match
    - Must setup product as ‘not for download’; no shipping required; basic product
    - Must embed PDFs into topic pages
    - Can have as many combos as you wish

    Functionality:
    - In driver.aspx.cs I modified the on_load event to do a DB lookup against 4 tables and redirect to default.aspx if order not found:
    a. Orders
    b. Orders_ShoppingCart
    c. Product
    d. Customer

    - Find a record that matches the following criteria: (returns CustomerID)

    a. Using CustomerID (derived from aspdnsf specific var ‘This.Customer’; available when logged in)
    b. Product.Name matches the page topic name
    c. Most recent purchase made <365 days ago and matches topic name
    d. Order was not voided, refunded, or frauded

    EXAMPLE SQL GENERATED:
    SELECT TOP 1 Customer.CustomerID, Orders.AuthorizedOn, Orders.RefundedOn, Orders.VoidedOn, Orders.FraudedOn, Orders_ShoppingCart.ProductID, Product.Name
    FROM Customer INNER JOIN Orders ON Customer.CustomerID = Orders.CustomerID INNER JOIN Orders_ShoppingCart ON Customer.CustomerID = Orders_ShoppingCart.CustomerID AND Orders.OrderNumber = Orders_ShoppingCart.OrderNumber INNER JOIN Product ON Orders_ShoppingCart.ProductID = Product.ProductID
    WHERE (DATEDIFF(dd, Orders.AuthorizedOn, GETDATE()) < 365) AND (Orders.CustomerID = '0') AND (Product.Name = 'eBook1')AND (Orders.RefundedOn IS NULL) AND (Orders.VoidedOn IS NULL) AND (Orders.FraudedOn IS NULL)
    ORDER BY Orders.AuthorizedOn DESC

    **This has been tested both using a login and not using a login. It seems to work. However, I would like some more testing done to ensure I didn’t miss a trick in the SQL query.

    THIS IS ENTERED IN THE ON_LOAD EVENT AND AFTER THE LINE
    int topicID = Topic.GetTopicID(PN); in driver.aspx
    ::::
    ==========================================

    //=================================
    //Modified by Beau D'Amore
    //6-7-2011
    //use the above topicID to find out if it's the eBook or not.
    //Use existing PN var to compare against topicname selected for eBook(s)
    //=================================

    //if we find 'eBook' in the topic title, look up subscription info in Orders table====
    if (PN.Contains("eBook"))
    {
    //look up in DB if topic was purchased and then if subscription is valid/expired==
    int ValidSubscription = 0;
    string sSQL = "SELECT TOP 1 Customer.CustomerID as [N], Orders.AuthorizedOn, Orders.RefundedOn, Orders.VoidedOn, Orders.FraudedOn, Orders_ShoppingCart.ProductID, Product.Name " +
    "FROM Customer INNER JOIN " +
    "Orders ON Customer.CustomerID = Orders.CustomerID " +
    "INNER JOIN Orders_ShoppingCart " +
    "ON Customer.CustomerID = Orders_ShoppingCart.CustomerID " +
    "AND Orders.OrderNumber = Orders_ShoppingCart.OrderNumber " +
    "INNER JOIN Product " +
    "ON Orders_ShoppingCart.ProductID = Product.ProductID " +
    "WHERE " +
    "(DATEDIFF(dd, Orders.AuthorizedOn, GETDATE()) < 365) AND " + //Must be within 365 days of AuthorizedOn date
    "(Orders.CustomerID = '" + ThisCustomer.CustomerID + "') AND " +
    "(Product.Name = '" + PN + "')" + //Make sure the product name matches the topic name for the page
    "AND (Orders.RefundedOn IS NULL) AND (Orders.VoidedOn IS NULL) AND (Orders.FraudedOn IS NULL) " + //Make sure it wasn't refunded/frauded/voided
    "ORDER BY Orders.AuthorizedOn DESC"; //Make sure it's ordered desc by AuthorizedOn to make sure we have the latest purchase in case they bought the years before

    //debugging for live server below.
    //Response.Write(sSQL);
    //Response.Flush();
    //Response.Clear();

    //ValidSubscription will stay 0 if no record found
    ValidSubscription = DB.GetSqlN(sSQL);

    if (ValidSubscription == 0)
    {
    //Abandon page/redirect to purchase
    Response.Redirect("default.aspx");
    }

    }

    //END of TOPIC MODIFICATION====================================== ====================
    //================================================== =================================
    Attached Files Attached Files