Copied to clipboard

Flag this post as spam?

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


  • Dan 1243 posts 3708 karma points admin c-trib
    Nov 04, 2015 @ 10:04
    Dan
    0

    Order empty when GetCurrentFinalizedOrder called after transaction completes

    Hi,

    I have a new Tea Commerce 3.0.4 site running on Umbraco 7.2.8. I'm using the SagePay payment gateway. Everything is great, the cart directs to SagePay's test system and the transaction completes - I receive an email confirmation and the order is visible in the Tea Commerce orders dashboard.

    The only problem is on the completion page (cart step 6) I'm getting the following error:

    Server Error in '/' Application.
    
    Object reference not set to an instance of an object.
    
    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
    
    Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
    
    Source Error: 
    
    
    Line 19:    </thead>
    Line 20:    <tbody>
    Line 21:        @foreach (OrderLine orderLine in order.OrderLines)
    Line 22:        {
    Line 23:            IPublishedContent productContent = Umbraco.TypedContent(orderLine.ProductIdentifier);
    

    The code which gets the finalised order in the cart step 6 template is pretty standard:

    @using TeaCommerce.Api.Models
    @using TeaCommerce.Umbraco.Web
    @inherits UmbracoTemplatePage
    @{
        Layout = "CartStepMaster.cshtml";
    
        IPublishedContent currentPage = Model.Content;
        IPublishedContent prevStep = currentPage.PrecedingSibling();
    
        //store id
        long storeId = long.Parse(currentPage.GetPropertyValue<string>("store", true));
    
        Order order = TC.GetCurrentFinalizedOrder( storeId );
    }
    

    But it would appear that the order is empty (or null) at this point.

    Can anyone spot why this is happening? Could it be something to do with the mini-cart at the top of the page creating a new order when the page is loaded?

    Many thanks.

  • Anders Burla Johansen 2560 posts 8256 karma points
    Nov 05, 2015 @ 12:40
    Anders Burla Johansen
    0

    What if you use the invoicing payment provider - does that make GetCurrentFinalizedOrder anything else than null?

    Kind regards

    Anders

Please Sign in or register to post replies

Write your reply to:

Draft