Page 1 of 1

digital goods/serial key question

Posted: Fri Jul 02, 2010 4:08 pm
by snap624
We have AC7.0.3

I was wondering if there is a way to make the serial key associated with a digital item only viewable by a customer AFTER they download their file for the first time? Right now, the key will post to their order history page or my digital goods page after it is activated. Basically we want the activated key only to be viewable after the customer clicks a button rather than be automatically viewable. We thought the download button would be just as good as any. Is there a simple way to do this?

Re: digital goods/serial key question

Posted: Mon Jul 05, 2010 5:03 am
by mazhar
Edit your Website/ConLib/MyOrderPage.ascx file and locate following code lines

Code: Select all

<asp:Label ID="SerialKeyLabel" runat="server" Text="Serial Key: " SkinID="FieldHeader" Visible='<%#!string.IsNullOrEmpty(Eval("SerialKeyData").ToString())%>'></asp:Label>
<asp:Literal ID="SerialKey" runat="server" Visible='<%#ShowSerialKey(Container.DataItem)%>' Text='<%#Eval("SerialKeyData")%>' />
and update them as below

Code: Select all

<asp:Label ID="SerialKeyLabel" runat="server" Text="Serial Key: " SkinID="FieldHeader" Visible='<%#ShowSerialKey(Container.DataItem)%>'></asp:Label>
<asp:Literal ID="SerialKey" runat="server" Visible='<%#ShowSerialKey(Container.DataItem)%>' Text='<%#Eval("SerialKeyData")%>' />
The edit Website/ConLib/MyOrderPage.ascx.cs file and locate following code

Code: Select all

protected bool ShowSerialKey(object dataItem)
    {
        OrderItemDigitalGood oidg = (OrderItemDigitalGood)dataItem;
        if (!string.IsNullOrEmpty(oidg.SerialKeyData) && oidg.SerialKeyData.Length <= 100)
        {
            return true;
        }
        return false;
    }
and update it as below

Code: Select all

protected bool ShowSerialKey(object dataItem)
    {
        OrderItemDigitalGood oidg = (OrderItemDigitalGood)dataItem;
        if (!string.IsNullOrEmpty(oidg.SerialKeyData) && oidg.SerialKeyData.Length <= 100 && oidg.Downloads.Count > 0)
        {
            return true;
        }
        return false;
    }
Save the files and test again.

Re: digital goods/serial key question

Posted: Sat Jul 24, 2010 10:28 am
by snap624
Hi, Mazhar:

Thanks for the response. When I change the code to what is posted above, the serial key does not show until the download link is clicked, but you have to refresh the page twice to see the serial code. Is there a way to have the code post when the download key is clicked without refreshing the page?

Also, when looking through the MyOrderPage.ascx code, I am not sure what this bit of code was related to as there is no link button in serial key field:

Code: Select all

 <asp:LinkButton runat="server" ID="SerialKeyLink" Text="view" OnClientClick="<%#GetPopUpScript(Container.DataItem)%>" Visible='<%#ShowSerialKeyLink(Container.DataItem)%>'></asp:LinkButton>
We basically want a record that the customer has viewed their code. We thought relating this to the download link would be the best way to do this since the number of downloads a customer makes is already recorded. If this other link button in the serial field can do something similar that would work as well. It seems to be a bit of vestigial code, though.