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?
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.
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?
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.
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.
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
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.
If they aren't, then display an error, but if they are, allow the button to complete. That could be one approach.
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?
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 beOrder.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.Ok, thanks Matt.
Could I use the new Finalizing event in v 3.3.0?
It doesn't appear to be documented yet?
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.
OK Matt. I'll hold off upgrading for now then.
Thanks,
Matt
is working on a reply...