digital goods/serial key question

Store UI, layout, design, look and feel; Discussion on the customer facing pages of your online store. Cascading Style Sheets, Themes, Scriptlets, NVelocity and the components in the ConLib directory.
Post Reply
snap624
Lieutenant (LT)
Lieutenant (LT)
Posts: 58
Joined: Mon Jan 19, 2009 2:53 pm

digital goods/serial key question

Post by snap624 » Fri Jul 02, 2010 4:08 pm

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?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: digital goods/serial key question

Post by mazhar » Mon Jul 05, 2010 5:03 am

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.

snap624
Lieutenant (LT)
Lieutenant (LT)
Posts: 58
Joined: Mon Jan 19, 2009 2:53 pm

Re: digital goods/serial key question

Post by snap624 » Sat Jul 24, 2010 10:28 am

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.

Post Reply