Copied to clipboard

Flag this post as spam?

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


These support forums are now closed for new topics and comments.
Please head on over to http://eureka.ucommerce.net/ for support.

  • Jacob 39 posts 88 karma points
    Feb 19, 2013 @ 20:29
    Jacob
    0

    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?

    Hope someone can help.

    Thanks.

  • Adam Jenkin 71 posts 226 karma points
    Feb 19, 2013 @ 22:16
    Adam Jenkin
    0

    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

  • Nickolaj Lundgreen 233 posts 1132 karma points
    Feb 19, 2013 @ 23:38
    Nickolaj Lundgreen
    0

    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.)?

     

  • Jacob 39 posts 88 karma points
    Feb 20, 2013 @ 09:17
    Jacob
    0

    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. 

     

  • Nickolaj Lundgreen 233 posts 1132 karma points
    Feb 20, 2013 @ 13:56
    Nickolaj Lundgreen
    0

    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.

  • Jacob 39 posts 88 karma points
    Feb 20, 2013 @ 21:21
    Jacob
    0

    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?

     
  • Nickolaj Lundgreen 233 posts 1132 karma points
    Feb 20, 2013 @ 21:37
    Nickolaj Lundgreen
    0

    Just add the querystring parameter to the Response.Redirect :)

    "?orderGuid=GUID"

  • Jacob 39 posts 88 karma points
    Feb 20, 2013 @ 21:42
    Jacob
    0

    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.

  • Nickolaj Lundgreen 233 posts 1132 karma points
    Feb 20, 2013 @ 21:52
    Nickolaj Lundgreen
    100

    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

    po.OrderGuid.ToString();

     

     

     

     

  • Jacob 39 posts 88 karma points
    Feb 20, 2013 @ 21:55
    Jacob
    0

    That worked!

    Thanks alot. :)

Please Sign in or register to post replies

Write your reply to:

Draft