Forum

Thread tagged as: Problem, Shop

Show Customer email address on confirm page

Hi there,

I’m currently creating a shop and during the checkout process I want to show a confirm page where the customer can see all his orders and his personal data (entered before). Everything is showed on the confirm page except his email address.

In customer_create.htm I have the following:

<perch:label for="email">E-Mail</perch:label>
    <perch:input type="email" id="email" required="true" placeholder="name@domain.de" />
<perch:error for="email" type="required">Please add your email address</perch:error>

In the confirm.html I have:

<tr>
<td>Name</td>
<td><perch:shop id="addressFirstName" /> <perch:shop id="addressLastName" /></td>
</tr>
<tr>
<td>Anschrift</td>
<td><perch:shop id="address_1" /><br><perch:shop id="postcode" /> <perch:shop id="city" /></td>
</tr>
<tr>
<td>Telefon</td>
<td><perch:shop id="phone" /></td>
</tr>
<tr>
<td>E-Mail</td>
<td><perch:shop id="email" /></td>
</tr>

In the output all fields on the confirm page are filled with the correct data, only the email field stays empty.

How can I solve this?

Rene Vogt

Rene Vogt 1 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Which page function are you using to display the template?

I used the same steps and templates as in your Nest demo:

<?php

    if (!perch_member_logged_in()) {
        PerchSystem::redirect('/register');
    }

    if (perch_shop_cart_has_property('terms_agreed')) {
        perch_shop_checkout('manual', [
            'return_url' => '/result',
            'cancel_url' => '/veranstaltungen',
            ]);
    }

    perch_layout('global/header');



    // Show the cart with a non-interactive template
    perch_shop_cart([
        'template'=>'cart/cart_static.html'
    ]);

    // Show the order addresses
    perch_shop_order_addresses();
    // perch_shop_order_addresses('addresses/confirm.html');

    // Display the form with the T&Cs checkbox
    perch_shop_form('checkout/confirm.html');

    perch_layout('global/footer');

which redirects to the register form, if customer is not logged in:

<?php

    if (perch_member_logged_in()) {
        PerchSystem::redirect('/checkout');
    }

    perch_layout('global/header');

    PerchSystem::set_var('shipping_weight', perch_shop_get_shipping_weight());
    perch_shop_registration_form(); 


    perch_layout('global/footer');

and as soon as the customer added his data it goes back to the confirm template

Drew McLellan

Drew McLellan 2638 points
Perch Support

If the customer is already registered, you don't want to show the registration form. That will attempt to create a new customer and then obviously fail.

But even with a new customer the email address is not shown on the confirmation screen. If I look at the members and orders in the control panel, the correct email address is in the system and the system also send the confirmation email to the customer.

Drew McLellan

Drew McLellan 2638 points
Perch Support

How are you attempting to display the email address?

The customer adds his email address in the form served by customer_create.html:

<perch:label for="email">E-Mail</perch:label>
<perch:input type="email" id="email" required="true" placeholder="name@domain.de" />
<perch:error for="email" type="required">Please add your email address</perch:error>

and in confirm.html it looks like this:

<tr>
<td>E-Mail</td>
<td><perch:shop id="email" /></td>
</tr>
Drew McLellan

Drew McLellan 2638 points
Perch Support

How is confirm.html displayed?

On the cart page I have a button for the next step:

<div class="button-group">
    <a class="button success" href="checkout">Weiter</a>
 </div>

So the user will be directed to the checkout page:

<?php
    if (!perch_member_logged_in()) {
        PerchSystem::redirect('/veranstaltungen/register');
    }
    if (perch_shop_cart_has_property('terms_agreed')) {
        perch_shop_checkout('manual', [
            'return_url' => '/veranstaltungen/result',
            'cancel_url' => '/veranstaltungen',
            ]);
    }
    perch_layout('global/header');

    // Show the cart with a non-interactive template
    perch_shop_cart([
        'template'=>'cart/cart_static.html'
    ]);

    // Show the order addresses
    perch_shop_order_addresses('addresses/confirm.html');

    // Display the form with the T&Cs checkbox
    perch_shop_form('checkout/confirm.html');

    perch_layout('global/footer');