Copied to clipboard

Flag this post as spam?

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


  • Kyle Eck 130 posts 280 karma points
    Feb 18, 2022 @ 15:19
    Kyle Eck
    0

    Vendr Checkout Customer Information Errors

    Matt,

    I am in development on a site where when the person clicks on checkout it asks them to either a) login or b) checkout as guest...

    When logging in as a member it successfully renders the customer information page for Vendr Checkout, but when checking out as a guest it throws a null error on the page.

    enter image description here

    Using the left hand form works perfectly, however using the right hand button, which is a link to /checkout/customer-information it throws the following error in VS for some reason.

    enter image description here

    I am not sure why this would be as everything seems to be installed correctly, If I am not logged in as a member my checkout throws this error. I am passing the proper order when not logged in and all the data is binding correctly and I can see it while debugging.

    Any thoughts?

    • Kyle
  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 18, 2022 @ 15:38
    Matt Brailsford
    0

    What does the right hand button actually do? Submit the same form? Or does it have it's own form? Or what is the mechanism for moving to checkout as guest? A GET request to the cart page?

  • Kyle Eck 130 posts 280 karma points
    Feb 18, 2022 @ 15:51
    Kyle Eck
    0

    The right hand is simply this:

    <a href="/checkout/customer-information" class="button yellow signin">Checkout as Guest</a>
    

    For the sake of brevity I have hardcoded it here but it will simply go get the checkout customer information url and that is it

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 18, 2022 @ 16:19
    Matt Brailsford
    0

    Do you have a stack trace as it's not exactly clear which thing is complaining. Maybe that'll shed some light.

  • Kyle Eck 130 posts 280 karma points
    Feb 18, 2022 @ 16:59
    Kyle Eck
    0

    Matt,

    Sorry for the poor format with this

    Here is the VS error:

    "   at ASP._Page_App_Plugins_VendrCheckout_views_VendrCheckoutInformationPage_cshtml.Execute() in C:\\My Files\\SMMoyerFireEcommerce\\SMMoyerFire\\App_Plugins\\VendrCheckout\\views\\VendrCheckoutInformationPage.cshtml:line 79"
    

    And here is the stack trace on screen: enter image description here

    Essentially it looks like its complaining about something being null but I have no clue what? Must I pass an ANti forgery toekn along the way?

    The form on the left does the following controller code that makes the checkout work:

        [HttpPost]
        [ValidateAntiForgeryToken]
        public ActionResult SubmitLogin(MemberLogin model)
        {
            IMemberService _memberService = Services.MemberService;
            if (ModelState.IsValid)
            {
                var member = _memberService.GetByUsername(model.Username);
                var redirectUrl = Umbraco.ContentAtRoot().Where(x => x.IsDocumentType("home")).First().DescendantsOrSelf().Where(p => p.Name == "My Account").First().Id;
    
    
                if (Members.Login(model.Username, model.Password))
                {
                    if (member.IsApproved)
                    {
                        //var dashboard = Umbraco.ContentAtRoot().Where(x => x.IsDocumentType("accountDashboard")).First().Id;
                        FormsAuthentication.SetAuthCookie(model.Username, false);
                        //return RedirectToUmbracoPage(dashboard);
    
                        //Redirect to checkout yes or no?
                        if (Request.QueryString["checkout"] == null)
                        {
                            redirectUrl = Umbraco.ContentAtRoot().Where(x => x.IsDocumentType("home")).First().DescendantsOrSelf().Where(p => p.Name == "Customer Information").First().Id;
                        }
    
                        return RedirectToUmbracoPage(redirectUrl, "checkout=" + Request.QueryString["checkout"]);
                    }
                    else
                    {
                        ModelState.AddModelError("", "Please verify your email address!");
                    }
                }
                else
                {
                    ModelState.AddModelError(nameof(model.Password), "Username or Password is incorrect!");
                }
            }
    
            return CurrentUmbracoPage();
        }
    
  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 21, 2022 @ 09:30
    Matt Brailsford
    0

    Hey Klye,

    Hmm, yea, I can't think what is null myself 🤔

    We only pass an antiforgery token for Umbraco v8 because in v9 the BeginUmbracoForm now auto adds one, so it is kinda needed for consistancy.

    This said, I'm really not sure why it's erroring there. If you remove the if statement and anti forgery token lines, does it stop erroring?

    Matt

  • Kyle Eck 130 posts 280 karma points
    Feb 21, 2022 @ 13:07
    Kyle Eck
    0

    Matt,

    I removed the forgery token and the Customer Information Dictionary line and the error simply moves up the code. See the screenshot below:

    enter image description here I am not sure exactly what would be null as there is little to no difference if I am logged in or not with a member.

    The only difference if they need to log in prior to checkout is the way in which i get the url.

    If they need to log in:

    //Redirect to checkout yes or no?
    if (Request.QueryString["checkout"] == null)
    {
         redirectUrl = Umbraco.ContentAtRoot().Where(x => x.IsDocumentType("home")).First().DescendantsOrSelf().Where(p => p.Name == "Customer Information").First().Id;
    }
    
    return RedirectToUmbracoPage(redirectUrl, "checkout=" + Request.QueryString["checkout"]);
    

    I should mention that the query string checkout here is nothing and in fact null.

    When they want to use guest checkout:

    @if (Request.QueryString["checkout"] == null)
    {
        <div class="login-form">
             <a href="/checkout/customer-information" class="button yellow signin">Checkout as Guest</a>
        </div>      
    }
    
  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 21, 2022 @ 13:56
    Matt Brailsford
    0

    Hmm, it's really hard to say when the null breakpoint just moves.

    Best I can suggest is just try commenting various things out until you find the one that make it work.

    What if you don't have the checkout= querystring? Does that still error?

    Matt

  • Kyle Eck 130 posts 280 karma points
    Feb 22, 2022 @ 17:59
    Kyle Eck
    0

    Matt,

    Ive been digging around this for a while and cannot find what would be null to cause this error.

    I did try going to on the vendr demo store (try.vendr.net) and what I want to do does work.

    However, I have some questions on Vendr Checkout doc types.

    1. Should I have a docType for each page or one single document type?
  • Kyle Eck 130 posts 280 karma points
    Feb 22, 2022 @ 19:38
    Kyle Eck
    0

    Matt,

    Did some digging, came out with nothing. Uninstalled and reinstalled and tested and it worked,

    One question for you though, If I am overriding your templates is there a proper way to do this? By override i mean basically put a ternary in to check a value and if not there use another value etc.

    So far I am phasing my changes in one at a time to see if it breaks, so far so good honestly.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 23, 2022 @ 09:22
    Matt Brailsford
    0

    Hmmm, sounds like maybe a rogue DLL from an upgrade maybe? 🤔

    RE overriding templates, I believe I have Vendr Checkout setup such that if you assign a template to the doc type and explicitly use it, it will prefer that over the default templates.

    I believe we also have a single doc type which has multiple templates for the different stages.

  • Kyle Eck 130 posts 280 karma points
    Feb 23, 2022 @ 10:56
    Kyle Eck
    0

    Matt,

    I stumbled across what was happening. I send users to a login or guest checkout page prior to checkout, well there’s no member to check with guest checkout.

    It’s an overlooked mistake on my part, we are all good now.

    As far as templates for Vendr checkout, what’s your timeline on another version or are you considering that final form?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 23, 2022 @ 11:44
    Matt Brailsford
    0

    Ahhh, glad you were able to find the solution.

    RE templates, is there something missing in the current ones? I was planning to take another look at Vendr Checkout to see if anything can be done better but I’m currently recovering from surgery so unable to give it the focus just yet.

    The current version should still be up to the job though in the meantime.

  • Kyle Eck 130 posts 280 karma points
    Feb 23, 2022 @ 12:01
    Kyle Eck
    0

    The current templates are fine, I was just curious if you had enhancements in the pipeline, for example right now I integrate members into checkout by asking if they want to save the address at checkout into their account. And furthermore if they are signed in at checkout I auto fill the address from the account they have on file.

    Are there plans to integrate an account or member accounts into Vendr/Vendr Checkout

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 23, 2022 @ 12:10
    Matt Brailsford
    0

    I did start Vendr Portal a while ago (a logged in customer area for order history etc), as we were going to use it for managing Vendr subscriptions but we ended up just using Stripes self service portal for that so we never quite finished it.

    It's something I want to look at though for sure and make improvements, it's just getting it in the schedule.

  • Kyle Eck 130 posts 280 karma points
    Feb 23, 2022 @ 12:14
    Kyle Eck
    0

    Ah interesting, I’ve done something similar but kept it within Umbraco. It’s not quite done but I would say I’m about 80% there.

    Semi related to that, would you advise using the Vendr email templates section for storing customer account emails (reset password, forgot password, account locked etc)

    Right now I store them in a site setting node. I feel like there should be a better way to store them.

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Feb 23, 2022 @ 12:33
    Matt Brailsford
    0

    The plan for Vendr Portal is indeed to use the Vendr email templates feature. It’s useable for custom templates so it’s defo built to allow this. It’s down to your own preference though really.

  • Kyle Eck 130 posts 280 karma points
    Feb 21, 2022 @ 14:07
    Kyle Eck
    1

    Hmm,

    Ill do some additional digging and see if I can get this to work, I had thought it would of been something with the Surface Controller on load but ran through the git code and nothing seems out of place with that.

    Ill keep scratching my head and try a few different things, the stack trace is rather dense and frankly not very helpful in this regard as it doesnt state what is null etc.

    Ill keep you posted

Please Sign in or register to post replies

Write your reply to:

Draft