Getting PurchaseOrder info in the Confirmation page.
Hello
I wanna give the customers using the webshop I am working on a complete view of the data they provided on the Confirmation page after the purchase. In the emails send out from the shop I get the order data with:
var orderGuid = new Guid(umbraco.library.RequestQueryString("orderGuid")); var purchaseOrder = PurchaseOrder.All().Single(x => x.OrderGuid == orderGuid);
This does not work on the confirmation page. How do I obtain the PurchaseOrder on that page?
I dont have any code or a site to look at at the moment but my first thought is that maybe the basket has not yet been converted into a purchase order when the order confirmation page is loaded.
I think this can occur for a number of reasons so this is what I would check first.
var orderGuid = new Guid(umbraco.library.RequestQueryString("orderGuid"));
I can not see any querystring on the url for the page. I could maybe attach it myself in the redirect, but what about the call from the payment gateways like DIBS, then it will probably be missing in those.
If you are using a payment provider, it will attach the correct querystring to the callback URL. If you manual redirect to the "order complete" page, you will have to add the querystring yourself.
I know how to add a querystring :) but how do you obtain the Guid from the PurchaseOrder? I tried with TransactionLibrary.GetBasket().PurchaseOrder, but get no basket present.
Getting PurchaseOrder info in the Confirmation page.
Hello
I wanna give the customers using the webshop I am working on a complete view of the data they provided on the Confirmation page after the purchase. In the emails send out from the shop I get the order data with:
This does not work on the confirmation page. How do I obtain the PurchaseOrder on that page?
Hope someone can help.
Thanks.
Hi Jason,
I dont have any code or a site to look at at the moment but my first thought is that maybe the basket has not yet been converted into a purchase order when the order confirmation page is loaded.
I think this can occur for a number of reasons so this is what I would check first.
Adam
Hi Jacob
Im using the same code as you
var order = PurchaseOrder.SingleOrDefault(x => x.OrderGuid == new Guid(umbraco.library.RequestQueryString("orderGuid")));
And that works just fine
Are you getting the correct guid for the order in the querystring, and does the checkout pipeline run correctly (clearing your basket etc.)?
Hi
I get the following error:
Error Loading Razor Script (file: uCommerce Confirmation) Unrecognized Guid format.In the line equal to the one Nickolaj posted:
var orderGuid = new Guid(umbraco.library.RequestQueryString("orderGuid"));
I can not see any querystring on the url for the page. I could maybe attach it myself in the redirect, but what about the call from the payment gateways like DIBS, then it will probably be missing in those.
If you are using a payment provider, it will attach the correct querystring to the callback URL. If you manual redirect to the "order complete" page, you will have to add the querystring yourself.
Hello
Nice to know that the querystring is allways present in callbacks from payment providers.
I am trying to get the orderGuid on a preview page. Where I run the following code:
TransactionLibrary.ExecuteBasketPipeline();TransactionLibrary.RequestPayments();HttpContext.Current.Response.Redirect("Confirmation.aspx");How would I do that?
Just add the querystring parameter to the Response.Redirect :)
"?orderGuid=GUID"
I know how to add a querystring :) but how do you obtain the Guid from the PurchaseOrder? I tried with TransactionLibrary.GetBasket().PurchaseOrder, but get no basket present.
Ahh sorry i misread, my bad!
This is how you do it
var po = SiteContext.Current.OrderContext.GetBasket().PurchaseOrder;
Put this before the code you posted to fetch the order before calling the payment (calling the payment removes the basket from the context).
The guid is now found here
That worked!
Thanks alot. :)
is working on a reply...