Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kevin Lawrence 183 posts 350 karma points
    Jul 30, 2014 @ 11:49
    Kevin Lawrence
    0

    Selling software licenses / upgrades etc.

    Hi guys

    Just wondering how I would go about implementing upgrade options in Merchello dynamically based on existing customer purchases.

    Basically, we are going to sell our product licenses through Merchello, which is fine for new licesnes, however if a user is already a license holder we will want to offer optional upgrades of which the price will be dynamically calculated depending on the users current license and time-left etc.

    How could I feed this into Merchello at runtime?  Is it possible? If so is it a lot of work?

    Thanks guys, and keep up the good work :-)

    Kev

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Jul 30, 2014 @ 18:02
    Rusty Swayne
    0

    Hi Kevin,

    We have thought of a scenario very similar (ours was wholesale pricing) and while I have yet to setup a store that implements the front facing logic the underlying code is in place. Merchello looks at things from a line item perspective with respects to the checkout workflow (not a product perspective).

    In your scenario, assuming your using MVC, you'd have a Controller/SurfaceController that would add items to the "Basket". We have a few examples of these and are happy to share. The Basket object (Merchello.Web.Workflow.Basket) has quite a few overloads of AddItem - my guess is you would use this one:

     public void AddItem(string name, string sku, int quantity, decimal price, ExtendedDataCollection extendedData)
    

    You would grab the name, sku, maybe default the quantity to 1 and dynamically set your price. You would then set the extendedData values you needed for checkout -

    maybe:

     extendedData.SetValue(Constants.ExtendedDataKeys.ProductKey, productVariant.ProductKey.ToString());
     extendedData.SetValue(Constants.ExtendedDataKeys.ProductVariantKey, productVariant.Key.ToString());
     extendedData.SetValue(Constants.ExtendedDataKeys.Price, **DYNAMIC-PRICE**.ToString(CultureInfo.InvariantCulture));
     extendedData.SetValue(Constants.ExtendedDataKeys.TrackInventory, False.ToString());
     extendedData.SetValue(Constants.ExtendedDataKeys.Taxable, productVariant.Taxable.ToString());
     extendedData.SetValue(Constants.ExtendedDataKeys.Shippable, productVariant.Shippable.ToString());
    
     // Download?
     extendedData.SetValue(Constants.ExtendedDataKeys.Download, productVariant.Download.ToString());
     extendedData.SetValue(Constants.ExtendedDataKeys.DownloadMediaId, productVariant.DownloadMediaId.ToString());
    

    There's also an AddItem method to add the product/product variant directly - in which case you could find the line item and adjust the extended data values as you see fit.

    Please let me know how it goes and if you need more explanation I'd be happy to chat with you over Skype. Having an actual implementation rather than concept always helps flush things out and I'll make sure we knock off any roadblocks if we find them.

    Thanks!

  • Kevin Lawrence 183 posts 350 karma points
    Jul 31, 2014 @ 16:27
    Kevin Lawrence
    0

    Hi Rusty

    Thanks very much, that looks extremely straight forward, I will give you a shout if I hit any issues but this looks good to me.

    Cheers

    Kev

Please Sign in or register to post replies

Write your reply to:

Draft