Copied to clipboard

Flag this post as spam?

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


  • Edgar Rasquin 191 posts 484 karma points
    23 days ago
    Edgar Rasquin
    0

    System.NullReferenceException in cart view

    Hi,

    I am on Vendr v.1.5.3 an I get an error when trying to show products in the cart:

    System.NullReferenceException
    

    on the line where I am trying to show the formatted price

     @(order.SubtotalPrice.Value.Formatted())
    

    enter image description here

    In debug it shows all the values such as orderline and even the price values:

    enter image description here enter image description here

    I thought that it could be related to the fact, that I removed the GBP so I have set up a new store but with no luck.

    Any ideas?

  • Matt Brailsford 3020 posts 15702 karma points MVP 7x c-trib
    23 days ago
    Matt Brailsford
    0

    Hmm, strange.

    And there is a currency defined with that ID?

  • Edgar Rasquin 191 posts 484 karma points
    23 days ago
    Edgar Rasquin
    0

    Yes, currency is EUR with quoted ID:

    enter image description here

    I am trying to implement the Shop in an Umbraco instance that was just migrated from v7.15 to v8.12. Could that cause any problems?

  • Matt Brailsford 3020 posts 15702 karma points MVP 7x c-trib
    23 days ago
    Matt Brailsford
    0

    I don't think that would pose a problem.

    Actually, I've just noticed in your first screenshot the error is coming from the order.SubtotalPrice but this is not the price you are debugging into in the debug screenshots. Can you debug into that and provide screenshots so I can see if anything in SubtotalPrice is null that shouldn't be?

    Matt

  • Edgar Rasquin 191 posts 484 karma points
    23 days ago
    Edgar Rasquin
    0

    Hi Matt,

    thanks for your reply.

    After I have pulled the code apart and put it all back together bit by bit, I could rule out that it had to do with the orderlines.

    Stupidly it was just the link to the checkout page causing the issue because I had not installed the Vendr.Checkout package...

    var checkoutPage = homePage.ChildrenOfType("vendrCheckoutCheckoutPage").FirstOrDefault();
    @checkoutPage.Url()
    

    .. stupid me :( But in my defence, I have to say that Visual Studio sometimes brings really weird messages that can quickly lead you astray.

    I'm sorry to have wasted your time and thanks again for your support. Have a nice evening.

  • Matt Brailsford 3020 posts 15702 karma points MVP 7x c-trib
    23 days ago
    Matt Brailsford
    0

    No need to apologise at all. Iā€™m glad you managed to get it working. And I agree, the YSOD was in no way helpful so great job on debugging it šŸ‘šŸ»šŸ§šŸ‘ØšŸ¼ā€šŸ’»

Please Sign in or register to post replies

Write your reply to:

Draft