Copied to clipboard

Flag this post as spam?

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


  • Marius 21 posts 91 karma points
    Jun 12, 2013 @ 10:20
    Marius
    0

    GetAllFinalizedOrdersForCustomer throws null reference exception

    I have external service that checks whether customer paid in 6 months. To check it, i use TC.GetAllFinalizedOrdersForCustomer(1, customer) and then get last payment date i find. But sometimes (way too often) GetAllFinalizedOrdersForCustomer throws NullReferenceException. I have no idea what is it. Can anyone help?

  • Marius 21 posts 91 karma points
    Jun 12, 2013 @ 10:44
    Marius
    0

    Ok, I realised that function GetAllFinalizedOrdersForCustomer works only if I am logged on another tab with same account as in function. Question change:

    How to get all finalized orders for member when not logged in?

  • Anders Burla 2560 posts 8256 karma points
    Jun 17, 2013 @ 11:25
    Anders Burla
    0

    Hi Marius

    The GetAllFinalizedOrdersForCustomertakes a customer id so that is just the one you need to send along. No need to be logged in to use this method.

    Kind regards
    Anders

  • Paul 11 posts 41 karma points
    Jun 23, 2013 @ 11:15
    Paul
    0

    I get some strange results using this method.  I am testing with a member who has two finialized orders.  My definition of finialized, if correct, is the orders table indicates an OrderNumber and finalized date?  There in total the member has 12 orders of which only two are finalized.

    I have a razor script which loops through the orders and orderlines.  On some occasions it displays just two orders and their lines correctly but most of the time it displays 8 orders of the same two orders.  Any idea what is happening here?  The script is:

    @using TeaCommerce.Umbraco.Web
    @using TeaCommerce.Api.Models
    @using umbraco.MacroEngines
    @using umbraco.cms.businesslogic.member
    @inherits umbraco.MacroEngines.DynamicNodeContext
    @{
        long storeId = long.Parse( Model._Store );
       
        Member member = Member.GetCurrentMember();
       
        IEnumerable<Order> orders = TC.GetAllFinalizedOrdersForCustomer( storeId, member.Id.ToString());
     

    int count = orders.Count();
        @count
       
    foreach (Order order in orders)
    {
        @order.OrderNumber
           
           
        <table>
          <tr>
            <th>
              @Dictionary[ "Image" ]
            </th>
            <th>
              @Dictionary[ "Name" ]
            </th>
            <th>
              @Dictionary[ "Quantity" ]
            </th>
            <th>
              @Dictionary[ "UnitPrice" ]
            </th>
            <th>
              @Dictionary[ "TotalPrice" ]
            </th>
          </tr>
          @foreach ( OrderLine orderLine in order.OrderLines )
          {

            //Product
            DynamicNode product = Model.NodeById( orderLine.ProductIdentifier.ToString() );

            //Image
            string imageId = TC.GetPropertyValue( storeId, orderLine.ProductIdentifier, "image" );
            string image = string.IsNullOrEmpty( imageId ) ? "" : Model.MediaById( imageId ).umbracoFile;
           
            <tr orderLineId="@orderLine.Id" nodeId="@product.Id">
              <td>
                <a href="@product.Url">
                  <img alt="" src="/ImageGen.ashx?Width=60&amp;Height=60&amp;Constrain=true&amp;Image=@image" />
                </a>
              </td>
              <td>
                <a href="@product.Url">
                  @orderLine.Name
                </a>
              </td>
              <td>
                  @orderLine.Quantity.ToString( "0.####" )
              </td>
              <td>
                @orderLine.UnitPrice
              </td>
              <td>
                @orderLine.TotalPrice
              </td>
            </tr>
           
       
          }
       
        </table>
           
    }

    }
  • Anders Burla 2560 posts 8256 karma points
    Jun 23, 2013 @ 13:54
    Anders Burla
    0

    Hi Paul

    Are you running the latest Tea Commerce? I know there was a bug that was fixed in 2.1.1. Try update to the latest version.

    Kind regards
    Anders

  • Paul 11 posts 41 karma points
    Jun 23, 2013 @ 18:48
    Paul
    0

    Hi Anders,

    Yeah I am running 2.1.2, upgraded from 2.1.1.

    Came back to it just now, logged in and saw two orders and then reloaded the page and get 8.  Is this a familar issue with 2.1.1?  I will check the biniaries have been updated if so.

     

    Cheers

  • Anders Burla 2560 posts 8256 karma points
    Jun 24, 2013 @ 08:53
    Anders Burla
    0

    No it shouldn't be a problem anymore. Could you try and verify the dll's has been updated. And that the xml order cache is refreshed - just delete the file from the App_Data/tea-commerce folder.

    Kind regards
    Anders

  • Paul 11 posts 41 karma points
    Jun 24, 2013 @ 10:25
    Paul
    0

    Ah ha deleting the cache did the trick.

     

    Great thanks,
    Paul

  • Hasheem Maloo 7 posts 29 karma points
    Jun 24, 2013 @ 11:31
    Hasheem Maloo
    1

    Multiple repeated orders listed when I use GetAllFinalizedOrdersForCustomer in razor, I upgraded to latest tea commerce a few days ago - and the problem disapeared - sadly its come back!

    Deleting the cache solves the probelm - but I'm not sure if this is a perminent fix?

    Thanks

     

    Hash

     

  • Anders Burla 2560 posts 8256 karma points
    Jun 24, 2013 @ 11:38
    Anders Burla
    0

    The GetAllFinalizedOrdersForCustomer method never adds orders to the cache. I will look into if there is a bug when changing a finalized order and the xml needs to save.

    Kind regards
    Anders

  • Anders Burla 2560 posts 8256 karma points
    Jun 24, 2013 @ 13:33
    Anders Burla
    0

    So you found a bug. In Tea Commerce 2.1.2- everytime a finalized order was saved it would add a new entry into the finalized orders xml file. I have fixed this in the current build and it will be released in 2.1.3.

    THANKS for finding this bug!

    Kind regards
    Anders

Please Sign in or register to post replies

Write your reply to:

Draft