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?
digital goods/serial key question
Re: digital goods/serial key question
Edit your Website/ConLib/MyOrderPage.ascx file and locate following code lines
and update them as below
The edit Website/ConLib/MyOrderPage.ascx.cs file and locate following code
and update it as below
Save the files and test again.
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")%>' />
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")%>' />
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;
}
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;
}
Re: digital goods/serial key question
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:
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.
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>