PrevPrev Go to previous topic
NextNext Go to next topic
Last Post 12/22/2017 2:19 PM by  Will Strohl
context.Inputs empty in custom workflow
 1 Replies
 1 Subscribed to this topic
 1 Subscribed to this forum
Sort:
You are not authorized to post a reply.
Author Messages





New Member






--
11/14/2017 10:01 AM
    During the Hotcakes checkout we are creating a new (customer) user account, entering a new username and password.
    We found out that the username which is used for creating the DNN account was built from forename and surname, not being the entered username during checkout.
    Thus if we enter customer details like this:
    - username 'tester'
    - forename 'idas'
    - surname 'company'
    The generated DNN user account has username 'ICompany' and not 'tester'.
    The Hotcakes source code states if the entered username during checkout is empty, the username will be generated like above.

    By debugging and overriding the DnnCreateUserAccountForNewCustomer (during LoadProcessNewOrderTasks) we discovered the context.Inputs were empty, which should hold the property ("hcc", "RegUsername").

    [b]Important: [/b]we are using a custom payment workflow also by overriding Task[] LoadThirdPartyCheckoutSelectedTasks().
    During a custom payment task, we saw the properties like regUsername are available in the context.Inputs.
    After 'leaving' the payment tasks code the context.Inputs seems to have become empty.

    Could anyone explain to us why the context.Inputs are empty during the CustomDnnCreateUserAccountForNewCustomer?
    For testing and debugging purposes,.we copied the hotcakes-core source code from DnnCreateUserAccountForNewCustomer to our CustomDnnCreateUserAccountForNewCustomer and did not change anything.

    We followed the examples 'custom Order Workflow' and 'Replacing the User Account Creation workflow' (from the core hotcakes source code which is also explained [url=https://hotcakescommerce.zendesk.com/hc/en-us/articles/209539786-Replacing-the-User-Account-Creation-Workflow-Task]here[/url] and [url=https://hotcakescommerce.zendesk.com/hc/en-us/articles/209539786-Replacing-the-User-Account-Creation-Workflow-Task]here[/url] https://hotcakescommerce....Workflow-Solution-).

    Some code clarification:
    [code=csharp]protected override Task[] LoadProcessNewOrderTasks()
    {
    return new Task[]
    {
    new WorkflowNote("Starting Process Order Workflow"),
    new UpdateOrder(),
    new CheckForZeroDollarOrders(),

    // new DnnCreateUserAccountForNewCustomer(),
    new CustomDnnCreateUserAccountForNewCustomer(),

    new AssignOrderToUser(),
    new AssignOrderNumber(),
    new MakeOrderAddressUsersCurrentAddress(),
    new AddUserAddressesToAddressBook(),
    new UpdateLineItemsForSave(),
    new UpdateOrder(),
    new DnnMakePlacedOrder(),
    new WorkflowNote("Finished Process Order Workflow"),
    new UpdateOrder(),
    };
    }[/code]

    This code results in an empty username / password:

    [code=csharp]
    public class CustomDnnCreateUserAccountForNewCustomer : CreateUserAccountForNewCustomer
    {
    public override bool Execute(OrderTaskContext context)
    {
    try
    {
    var existAccount =
    context.HccApp.MembershipServices.Customers.Find(context.UserId);

    if (existAccount == null)
    {
    // username will be empty string
    var username = context.Inputs.GetProperty("hcc", "RegUsername");
    var password = context.Inputs.GetProperty("hcc", "RegPassword");
    _isCreateGuestAccount = string.IsNullOrEmpty(username);

    ...[/code]

    In below code, the context.Inputs is still available:

    [code=csharp]public class StartCustomCheckout : ThirdPartyCheckoutOrderTask
    {
    public bool ProcessCheckout(OrderTaskContext context)
    {
    if (context.HccApp.CurrentRequestContext.RoutingContext.HttpContext != null)
    {
    try
    {
    string reguser = context.Inputs.GetProperty("hcc", "regUsername");

    ...[/code]

    Thanks





    Veteran Member






    --
    12/22/2017 2:19 PM
    The guest checkout is intentionally unaware of the username field when creating the username for a new customer that uses the guest checkout. This will likely remain that way. While a technical person would or could naturally attribute the username to the account creation, most everyone else would not. The user experience is disconnected from each other, as evidenced by the radio buttons that switch between login and guest checkout.
    Will Strohl, Upendo Ventures Hotcakes Cloud | Get Support | Code Support Official Cloud & Support provider for Hotcakes
    You are not authorized to post a reply.


    Loading
    • Sign-up for the Hotcakes Community Newsletter: