Custom serial key provider - what fields are available?

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
DS1
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Mon Jan 21, 2008 2:22 pm

Custom serial key provider - what fields are available?

Post by DS1 » Mon Jul 28, 2008 7:20 pm

Hello,

I have just upgraded to 7.0 Final.

I have a custom serial key provider for my digital goods. When my user purchases quantity 3 of a digital good, I would like to provide a single serial number for that item. In version 7.0 Final my serial key provider is called 3 times and 3 serials are generated, very different from RC2. In my opinion, a custom serial key provider should only be called a single time per product ordered, regardless of the quantity.

Since the AC7 source is not available, one workaround is to compare the OrderItemID and give back the same serial number from my serial key generator. Unfortunately, the only data I can find being sent to the custom serial key provider is the DigitalGoodID and the UserName. Is there a way to get the OrderItemID to be sent?

I would really appreciate some help on finding a solution.

thanks!

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Custom serial key provider - what fields are available?

Post by sohaib » Wed Jul 30, 2008 12:21 pm

Hello,

I just looked into this in more detail. I realize that its pretty difficult to retrieve the orderid/orderitemid inside the AcquireSerialKey method in a provider implementation. May be the OrderItemDigitalGood object for which this method gets invoked should have been passed as parameter. I have entered this as a bug in our bug tracking system and we are getting this discussed.

DS1
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Mon Jan 21, 2008 2:22 pm

Re: Custom serial key provider - what fields are available?

Post by DS1 » Thu Jul 31, 2008 10:48 pm

Is this available as a patch now? We really need to convert to AC7 Final.

thank you for your help.

User avatar
AbleMods
Master Yoda
Master Yoda
Posts: 5170
Joined: Wed Sep 26, 2007 5:47 am
Location: Fort Myers, Florida USA

Re: Custom serial key provider - what fields are available?

Post by AbleMods » Sun Aug 03, 2008 9:39 pm

DS1 wrote:In version 7.0 Final my serial key provider is called 3 times and 3 serials are generated, very different from RC2. In my opinion, a custom serial key provider should only be called a single time per product ordered, regardless of the quantity.
What you're describing is quite different from most software serialization models. You're pretty much serializing only the customer purchase and not the products themselved. The usual intent of a "serial number" is to individualize the item purchased for identification and security purposes.

The serial key hook should have the option for both. But then you open the door to other variations:
1. One call per order
2. One call per customer
3. One call per line item
4. One call per unique SKU ignores quantity (your situation)
5. One call per unique SKU per quantity (how final works)
Joe Payne
AbleCommerce Custom Programming and Modules http://www.AbleMods.com/
AbleCommerce Hosting http://www.AbleModsHosting.com/
Precise Fishing and Hunting Time Tables http://www.Solunar.com

User avatar
sohaib
Developer
Developer
Posts: 1079
Joined: Fri Jan 23, 2004 1:38 am

Re: Custom serial key provider - what fields are available?

Post by sohaib » Mon Aug 04, 2008 8:33 am

Thanks Joe you summed it up beautifully.
Of-course we will not change the way it is working currently.
The only enhancement we are currently discussing is possibility of allowing the custom implementations to retrieve the order item Id for which the calls are being made.

DS1
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Mon Jan 21, 2008 2:22 pm

Re: Custom serial key provider - what fields are available?

Post by DS1 » Mon Aug 04, 2008 9:52 pm

That is fine with me. When can we have a patch?

DS1
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 23
Joined: Mon Jan 21, 2008 2:22 pm

Re: Custom serial key provider - what fields are available?

Post by DS1 » Sun Aug 10, 2008 8:59 pm

Can I please get an update?

num5labonte
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Wed Nov 19, 2008 6:24 am

Re: Custom serial key provider - what fields are available?

Post by num5labonte » Thu Dec 03, 2009 6:36 am

Quick question

We have a custom provider which issues serial keys for software licensed on a per seat basis. So on a single line item if I purchased a quantity of 4 for Product A, I get a 4 seat license. So I would send the product Id , quantity, etc and be returned a 4 seat serial number.

After reading the bug discussion http://bugs.ablecommerce.com/show_bug.cgi?id=7047, it seems Sohaib's comment regarding overriding the AcquireSerialKey and using the oidg.OrderItemId to issue the same serial number for all 4 will take care of part of my issue. However is there a way to obtain the quantity for the oidg.OrderItemId without directly querying the db against that ID? Such as oidg.OrderItemId.Quantity

Thanks
Andrew.

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

Re: Custom serial key provider - what fields are available?

Post by mazhar » Thu Dec 03, 2009 7:27 am

Try this

Code: Select all

oidg.OrderItem.Quantity

num5labonte
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Wed Nov 19, 2008 6:24 am

Re: Custom serial key provider - what fields are available?

Post by num5labonte » Fri Dec 11, 2009 6:53 am

Thanks mazhar.

Two more questions.

1. On the Digital Good email notification. I have it set to send the serial number upon fulfillment, however it sends an email for each quantity on the line item. How can I configure it to send just one email for an individual line item? Example: If I purchased 4 seats of a product on 1 line item, I am issued 1 fulfillment email.

2. Can I include the download link in the email instead of having them log into their account to get it?

Thanks,
Andrew

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

Re: Custom serial key provider - what fields are available?

Post by mazhar » Fri Dec 11, 2009 8:15 am

Please read following thread where some NVelocity script is used to generate thumbnail link. You have do something similar with digital good in corresponding Email template.
viewtopic.php?f=44&t=7553

num5labonte
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Wed Nov 19, 2008 6:24 am

Re: Custom serial key provider - what fields are available?

Post by num5labonte » Mon Jan 18, 2010 5:43 am

Instead of using the default Key fulfillment email. I am trying to add the serial key to the order confimation email however I cant seem to access the key using the same code from the License key is fulfilled template.

Using $orderItemDigitalGood.SerialKeyData from within the loop for the products in the the Non-Shipping Items table just displays "$orderItemDigitalGood.SerialKeyData"

I am thinking orderItemDigitalGood is available directly in the fulfillment template and not in the Customer Order Notification template.
Can I access the orderItemDigitalGood values such as DigitalGood.Name and SerialKeyData?

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

Re: Custom serial key provider - what fields are available?

Post by mazhar » Mon Jan 18, 2010 7:08 am

num5labonte wrote:Instead of using the default Key fulfillment email. I am trying to add the serial key to the order confimation email however I cant seem to access the key using the same code from the License key is fulfilled template.

Using $orderItemDigitalGood.SerialKeyData from within the loop for the products in the the Non-Shipping Items table just displays "$orderItemDigitalGood.SerialKeyData"

I am thinking orderItemDigitalGood is available directly in the fulfillment template and not in the Customer Order Notification template.
Can I access the orderItemDigitalGood values such as DigitalGood.Name and SerialKeyData?
Yes you are right some data is available only in that context. For example $orderItemDigitalGood data variable is avilable in fulfillment template. Any how here is a workaround to access orderItemDigitalGood through current order item object. I am not sure that its populated correctly when order confirmation is triggered by you can give it a try.

You need to put this NVelocity code some where in Email template where a valid order item object is available. For example locate following code in order confirmation template

Code: Select all

#foreach($orderItem in $order.Items.FilterByShipmentAndSort($shipment.OrderShipmentId))
#beforeall
and then replace it as below.

Code: Select all

#foreach($orderItem in $order.Items.FilterByShipmentAndSort($shipment.OrderShipmentId))
#beforeall
<tr>
<td colspan="4">
#if($orderItem.DigitalGoods.Count > 0)
#set($orderItemDigitalGood=$orderItem.DigitalGoods.get_Item(0))
<b> Now $orderItemDigitalGood is avilable here you can use it</b>
$orderItemDigitalGood.SerialKeyData
#end
</td>
</tr>  
Now you can see that a new variable $orderItemDigitalGood is avilable and you can test your code against it.

num5labonte
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Wed Nov 19, 2008 6:24 am

Re: Custom serial key provider - what fields are available?

Post by num5labonte » Mon Jan 18, 2010 7:39 am

Thanks Mazhar,

Tested and working.

Andrew

num5labonte
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Wed Nov 19, 2008 6:24 am

Re: Custom serial key provider - what fields are available?

Post by num5labonte » Thu Feb 04, 2010 4:14 pm

I have an issue thats come up with the custom provider. If a user already has an account then when I pass oidg.OrderItem.Order.User.Email and oidg.OrderItem.Order.UserId it works as expected. However if this is their first time in the system the UserID is actually the ID of the annonoymous account and the email is blank.

So I am wondering, Is the SerialKey provider kicking off before the user account is created or am I grabbing the wrong fields?

num5labonte
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Wed Nov 19, 2008 6:24 am

Re: Custom serial key provider - what fields are available?

Post by num5labonte » Thu Mar 11, 2010 7:57 am

Since there was no response to my question, let me see if I can clarify the issue.

When the customer checks out, the custom serial key provider passes the oidg.OrderItem.Order.User.Email & oidg.OrderItem.Order.UserId along with the product information to the license server. If the customer already has an account in the system it works as expected. If the customer is a new user who has not yet set up an account, then the anonymous userid and no email address is pased to the license server. Looking at the data it seems that the AquireSerialKey is kicking off before the user account is being created when the customer checks out.

So my question is, Am I passing the wrong items to the license server? oidg.OrderItem.Order.User.Email & oidg.OrderItem.Order.UserId
Or is there a way to change the current process to create the users account at checkout before the AquireSerialKey method executes?


Thanks,
Andrew

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

Re: Custom serial key provider - what fields are available?

Post by mazhar » Thu Mar 11, 2010 8:25 am

Well when an anonymous user registers then information from anonymous user is migrated to the new one. So I am not sure but this might be the case that you sent the user id of anonymous user and then after checkout it migrated to new user so old user id is no more valid. The process of registering a user is in CheckedOut method of OnePageCheckout page. Its called automatically after completing checkout. So can put you licensing code some where beneath it so that you always get a registered user for licensing.

num5labonte
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Wed Nov 19, 2008 6:24 am

Re: Custom serial key provider - what fields are available?

Post by num5labonte » Thu Mar 11, 2010 9:50 am

Yes. That is exactly what is happening. However I am using a custom registered provider, so the licensing is handled at whatever stage the digital good provider kicks off.

At check out for a digital good: The digital good serial key provider contacts the external server, passing the client Id and prouct information, and then returns a serial key back to AbleCommerce. You are correct after the digital good provider executes, then the anonymous account is migrated into a new account. However at this point there is now a disconnect on the licensing sytem because the user id associated with the serial key is no longer the correct userid in Able.

Was hoping there was a way to grab the migrated account info or at least the correct email address. Since the user has to put their email address into the checkout page can I grab that value? Instead of passing oidg.OrderItem.Order.User.Email can I access the information inputted in the email textbox? Then I can run an update between the two systems to grab the correct userID after the account is migrated.

Thanks
Andrew

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

Re: Custom serial key provider - what fields are available?

Post by mazhar » Thu Mar 11, 2010 10:16 am

Try using NewUserName.Text to get the user Email on final screen of checkout where it asks about password.

num5labonte
Ensign (ENS)
Ensign (ENS)
Posts: 19
Joined: Wed Nov 19, 2008 6:24 am

Re: Custom serial key provider - what fields are available?

Post by num5labonte » Thu Mar 11, 2010 4:00 pm

NewUserName.Text wouldn't be exposed to the extended SerialKey provider though would it as oidg.OrderItem.Order.User.Email is?

Is there anyway to change when the SerialKey provider executes at checkout so that it happens after the user account is merged? Just doesn't seem right for that to execute first.

Post Reply