Copied to clipboard

Flag this post as spam?

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


  • Neil Hodges 5 posts 85 karma points
    Aug 01, 2022 @ 09:20
    Neil Hodges
    0

    Create Member - Vendr Checkout

    Hi

    On Umbraco 8 , I'm looking at creating a Member and some other logic while using the Vendr Checkout Plugin.

    Currently I'd like the user to create an account upon entering their contact information.

    At the /checkout/customer-information page I'd like to add a password field in the VendrCheckoutInformationPage.cshtml, I can see the form and it posts to UpdateOrderInformation in VendrCheckoutSurface.

    I assume I'm hooking into the save/update event here? Normally I'd of sone all this manually but with Vendr Checkout im unsure where I need to be hooking into the update events for UpdateOrderInformation.

    Anyone able to point me in the right direction here please?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 01, 2022 @ 09:42
    Matt Brailsford
    100

    Hi Neil,

    When you say add a password field, is this just for creating the member account?

    If so, I think personally I'd be tempted to add it on the Comfirmation page and have something like "Enter a password to come back to your order later". You can then have that form post to your own custom SurfaceController passing the order ID and the password then you can extract the customer email from the order and setup the member accordingly.

    This would save you having to modify the Vendr Checkout stuff.

    Matt

  • Neil Hodges 5 posts 85 karma points
    Aug 01, 2022 @ 09:52
    Neil Hodges
    0

    Hey Matt

    Thanks for answering so quickly.

    Ah yes, I have normally done that before, wait until the user is at the confirmation page stage and then create them as a member from there.

    However, I'm assigned a ticket that asks to create the member where they fill out their email address, password and first and last name.

    I'll ask for clarity on it. But yeh it does seem easier to do at the end of the checkout through a custom surface controller.

    If it isn't, what would be the approach to hook into the contact information save event from the vendr checkout?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 01, 2022 @ 09:57
    Matt Brailsford
    1

    Hey Neil,

    You can find details on hooking into events here https://vendr.net/docs/core/2.1.0/umbraco-v8/key-concepts/events/ So you could try listening for OrderSavingNotication and see if you can get what you need from there to create the member.

    Failing this, you may need to pull the source for Vendr Checkout and run on a custom codebase modifying the customer details controller to add the member logic in.

    Matt

  • Neil Hodges 5 posts 85 karma points
    Aug 01, 2022 @ 10:00
    Neil Hodges
    0

    Hi

    Thanks, yeh just been looking at the OrderSavingNotification so good to know I was in the right area.

    Hopefully I can do it at the end of the checkout as the rest seems a bit long winded to do especially with the ETC I've been given to implement the feature.

    Thanks again buddy!

  • Neil Hodges 5 posts 85 karma points
    Aug 04, 2022 @ 13:24
    Neil Hodges
    0

    Hey Matt

    Im wanting to add in the 'Password' field into the VendrCheckoutInformationPage.cshtml is it a case of just adding the following:

    <input name="password" type="password" placeholder="Password" class="block placeholder-gray-700 border border-gray-300 py-2 px-4 mb-2 mx-1 w-full"
           value="@(currentOrder.Properties["password"])" />
    

    And then maybe call:

    var password = evt.Order.OrderLines.First().Properties["password"]?.Value;
    

    This would be in

    public override void Handle(OrderTransactionUpdatedNotification evt)

    Is there anything else i need to do to tell it to save this property against the order?

  • Matt Brailsford 4124 posts 22215 karma points MVP 9x c-trib
    Aug 04, 2022 @ 13:54
    Matt Brailsford
    0

    Hey Neil,

    Vendr Checkout only knows how to handle the properties it was built for so if you are adding new prooperties you'll need to also extend the controller to handle this extra property.

    Currently the only real way to do that is to build a custom build of the package with a modified controller.

    Realisticly, as soon as you need something that Vendr Checkout doesn't do, you'll likely want to use a custom checkout flow / custom build.

  • Neil Hodges 5 posts 85 karma points
    Aug 04, 2022 @ 13:58
    Neil Hodges
    0

    Yeh, thought that might be the case reading through the Doc's. I think we have gone down the Vendr Checkout route as a quick win.

    But I think we're trying to do too much with it and at this stage, we're going to have to go a custom route I think as more features get requested.

    Thanks tho, It just confirms what I probably already knew :)

Please Sign in or register to post replies

Write your reply to:

Draft