Developer forum

Forum » Ecommerce - Standard features » Subscribe user on checkout

Subscribe user on checkout

Bogdan Ciocsan
Reply

Hi all

I am trying to create a checkbox that helps people subscribe during the checkout phase. I have checked "Newsletter subscription" in the Cart V2 module. I can see that some information regarding the newsletter subscription is submitted, but the user is not created in the back-end.

Following code is used on one of my steps: 

            @if (GetBoolean("Ecom:Cart.UseNewsletterSubscription"))
            {
                var isChecked = GetBoolean("Ecom:Order.Customer.NewsletterSubscribe");

                <div class="form-inline">
                    <div class="form-group">
                        <div class="checkbox">
                            <label class="checkbox" for="EcomOrderSubscribeToNewsletter">
                                <input type="hidden" name="EcomOrderSubscribeToNewsletter" />
                                <input type="checkbox" name="EcomOrderSubscribeToNewsletter" id="EcomOrderSubscribeToNewsletter" tabindex="17" />
                                <strong>@Translate("Cart.SubscribeNewsletter.Text", "Få gode tilbud, nyheder før alle de andre og meget mere - tilmeld dig vores nyhedsbrev"</strong>
                            </label>
                        </div>
                    </div>

                </div>
            }

I have to mention that I am not using the Newsletter V3 module, and I want to use the standard Email Marketing module. 

Does anyone know what might be wrong? 

Best regards

Bogdan 


Replies

 
Merethe Vrå Andersen
Reply
This post has been marked as an answer

Hi,

For new users you need to check "Create user during checkout" in paragraph settings for the shopping cart in order to create the user in User Management.

From http://manual.dynamicweb-cms.com/Default.aspx?ID=7190

Setup Create user during checkout
Select the default template InformationCreateUser.html in step 2 in the Steps section.
Enable Create user during checkout in the User Management section.
In Groups for new users you select a user group where the created users should be created.
Save paragraph settings and go to frontend and create an order.
Select Save me as customer and fill user name and password and other relevant details.
When the order is completed the user is created in the selected User Management group and also logged in in frontend.

Note that the user is created during checkout. If you e.g. cancel the order from the payment provider then the user is still created.

Kind regards,
Merethe

Votes for this answer: 1
 
Bogdan Ciocsan
Reply

Hi Merethe
Thank you for your help :)

I forgot to mention that the "create user" was checked during checkout, and nothing happened, but I guess the problem was that my checkout flow did not have the inputs from the InformationCreateUser.html step, which I now added and it solved the problem.

Best regards

Bogdan

 
Bogdan Ciocsan
Reply

Hi again

We have experienced some problems with the checkout process when the user was present in our extranet. The page would refuse to function and would not continue to checkout. The solution provided in InformationCreateUser.html by checking if Global:Extranet.Name is defined, would not work for our solution, because we have no login functionality. 

We solved it by checking if the user was present or not, before creating the user: 

@if (GetBoolean("Ecom:Order.Customer.NewsletterSubscribe")) {
    var user = Dynamicweb.Modules.UserManagement.User.GetUserByUserName(GetString("Ecom:Order.Customer.Email"));
    if (user == null || user.ID == 0)
    {
        var pass = Dynamicweb.Base.PasswordGenerate("10");
        <input type="hidden" name="EcomUserCreateNew" value="true"/>
        <input type="hidden" name="EcomUserCreateUserName" value="@GetValue("Ecom:Order.Customer.Email")"/>
        <input type="hidden" name="EcomUserCreatePassword" value="@pass"/>
        <input type="hidden" name="EcomUserCreateConfirmPassword" value="@pass"/>
    }
}

But I think, this should be something that DW should check in the back-end.

Especially because our site does not use the login functionality, and it's just a simple eCommerce solution, and the newsletter checkbox is basic functionality that should be available "out-of-the-box" and should not require extra coding time. 

Would be nice if there was a checkbox under Cart V2; something like "use simple user creation" instead of us hardcoding hidden inputs, and the current user creation could be just available as "advanced user creation" for those who really need to do it manually. 

Best regards

Bogdan 

 
Charlotte Mogensen
Reply

Hi Bogdan,

Would you mind inserting the whole newsletter subscription section of your template? I have a case where the user always exist as a user, and I can't it to subscribe in Email marketing during checkuout no matter what I do. 

kind regards,

Charlotte

 

You must be logged in to post in the forum