Copied to clipboard

Flag this post as spam?

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


  • Matt Taylor 810 posts 1900 karma points
    Jan 31, 2019 @ 11:12
    Matt Taylor
    0

    Best place to check stock before purchase

    I'd like to do a final check of stock levels before the customer makes the purchase in TC v3.

    On my final page I'm using TC.GeneratePaymentForm so the next click will complete the booking.

    What the best way to use the .Net API to check the stock at the last possible stage and inform the customer if something needs to be changed before a product is purchased?

    Is there an event I should be using perhaps? BeforeOrderFinalized?

    Thanks,

    Matt

  • Matt Brailsford 2149 posts 10592 karma points MVP 6x c-trib
    Jan 31, 2019 @ 11:40
    Matt Brailsford
    0

    Hmm, I'm not sure there is a BeforeOrderFinalized event.

    Off the top of my head I'm thinking that maybe you could add a javascript handler to intercept the submit button click within the payment form and prevent it from submitting, but then call the TC js API to check if all the items are still in stock.

    TC.getStock({storeId:1, productIdentifier:'1076'});
    

    If they aren't, then display an error, but if they are, allow the button to complete. That could be one approach.

  • Matt Taylor 810 posts 1900 karma points
    Jan 31, 2019 @ 11:46
    Matt Taylor
    0

    Thanks Matt,

    There used to be events AfterOrderFinalized & BeforeOrderFinalized in TeaCommerce.Data.Extensibility in previous versions of TC but I can't find them in version 3.

    They were pretty useful events to hook into so what do we do now in v3 if we need to process something before or after an order has taken place?

  • Matt Brailsford 2149 posts 10592 karma points MVP 6x c-trib
    Jan 31, 2019 @ 11:59
    Matt Brailsford
    0

    There is a Order.Finalized event that occurs after an order is finalized, but there isn't current one that fires before. The best there would be would be Order.Updating event, though that wouldn't really know if it's about to be finalized.

    I'll have a look back through the commit logs to see if there was a reason for not having a Finalizing event incase there was a reason, but unfortunately there isn't one currently.

  • Matt Taylor 810 posts 1900 karma points
    Jan 31, 2019 @ 12:07
    Matt Taylor
    0

    Ok, thanks Matt.

  • Matt Taylor 810 posts 1900 karma points
    Mar 06, 2019 @ 16:33
    Matt Taylor
    0

    Could I use the new Finalizing event in v 3.3.0?

    It doesn't appear to be documented yet?

  • Matt Brailsford 2149 posts 10592 karma points MVP 6x c-trib
    Mar 07, 2019 @ 08:32
    Matt Brailsford
    0

    Hi Matt,

    Sorry, I totally forgot to come back to this.

    Yes you could, however we don't have a means of canceling an event yet so you could use it to check the stock level, but the transaction would still go through.

    I still need to look into what it would take to make them cancel-able.

  • Matt Taylor 810 posts 1900 karma points
    Mar 07, 2019 @ 12:45
    Matt Taylor
    0

    OK Matt. I'll hold off upgrading for now then.

    Thanks,

    Matt

Please Sign in or register to post replies

Write your reply to:

Draft