Jump to content

Photo

Selling downloadable products with unique license (product/serial) key codes

product key license code serial number

  • Please log in to reply
2 replies to this topic

#1 coliff

coliff

    Newbie

  • Members
  • Pip
  • 2 posts

Posted 31 March 2016 - 11:38

We need to be able to sell a downloadable product (software) with each order including a unique product key code. Can Smartstore.NET deal with that via an available plugin?


  • RidgeOi likes this

#2 Frank Crowder

Frank Crowder

    Newbie

  • Members
  • Pip
  • 3 posts

Posted 23 June 2016 - 16:23

can anyone provide me the point in code that creates the email sent to the customer for "order complete here is your order info"? at this point I can add my hook to create my product key and add it to the email.

 

frank



#3 Murat Cakir

Murat Cakir

    SmartStore AG

  • Administrators
  • 1118 posts

Posted 23 June 2016 - 18:20

Just a blueprint:

public class OrderTokensAddedEventConsumer : IConsumer<EntityTokensAddedEvent<Order, Token>>
{
	public void HandleEvent(EntityTokensAddedEvent<Order, Token> eventMessage)
	{
		var entity = eventMessage.Entity;
		var tokens = eventMessage.Tokens;

		// fetch the license key assigned to the given order from wherever you saved it 
                // (generic attributes, session etc.)
		var licKey = "xxx-xxx-xxx";
		
		// add your token to the list of available message tokens
		tokens.Add(new Token("Order.MyLicenseKey", licKey));
	}
}

Rendering custom message tokens involves editing the corresponding message templates in CMS > Message Templates (e.g the template OrderPlaced.CustomerNotification). Just place the token %Order.MyLicenseKey% anywhere in the message body.


  • Frank Crowder likes this

Murat Cakir
SmartStore AG



Also tagged with one or more of these keywords: product key, license code, serial number