Forum

Thread tagged as: Members, Shop

Shop customer form and registration

Hi

On a Perch Shop site I'm working on, the client will be selling memberships to access certain areas of the site. It doesn't make sense for them to be able to register an account if they are not joining and paying, so I've replaced any calls to the register form to a join button instead (which takes them to the product to buy).

But I would like to collect additional info about the customer. I've added some additional fields to the customer_create template, for example...

<div class="form-group">
    <perch:label for="dob">Date of birth</perch:label>
    <perch:input class="form-control" type="text" id="dob" required="true" label="Date of Birth" placeholder="DD/MM/YY" />
    <perch:error for="dob" type="required">Please add your date of birth</perch:error>
</div>

...along with a few others, but I've noticed this doesn't get stored along with the Members info.

Without the initial register form, am I unable to add any more information into their profile?

Diagnostics

Perch: 2.8.29, PHP: 5.4.42, MySQL: mysqlnd 5.0.10 - 20111026 - $Id: c85105d7c6f7d70d609bb4c000257868a40840ab $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.29), assets (2.8.29), categories (2.8.29), perch_shop_orders (1.0.6), perch_shop_products (1.0.6), perch_shop (1.0.6), perch_members (1.5)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_members', 'perch_shop', );
PERCH_LOGINPATH: /perch
PERCH_PATH: /Volumes/FFD Web Work/Euro Med/root/perch
PERCH_CORE: /Volumes/FFD Web Work/Euro Med/root/perch/core
PERCH_RESFILEPATH: /Volumes/FFD Web Work/Euro Med/root/perch/resources
Image manipulation: GD
PHP limits: Max upload 32M, Max POST 32M, Memory: 128M, Total max file upload: 32M
F1: 2edba60ed1f613d6dd804feb202456a2
Resource folder writeable: Yes
HTTP_HOST: euromed
DOCUMENT_ROOT: /Volumes/FFD Web Work/Euro Med/root
REQUEST_URI: /perch/core/settings/diagnostics/
SCRIPT_NAME: /perch/core/settings/diagnostics/index.php
Wayne Hooper

Wayne Hooper 6 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

It doesn't get stored, or isn't being displayed?

It's not stored when I click on the Member in the Member app, or in the Invoice in Orders.

Just noticed this when logging in with debug on...

Array
(
    [type] => 8
    [message] => Use of undefined constant PERCH_SHOP_VERSION - assumed 'PERCH_SHOP_VERSION'
    [file] => /home/myserver/public_html/euromed/perch/addons/apps/perch_shop_orders/admin.php
    [line] => 3
)
Drew McLellan

Drew McLellan 2638 points
Perch Support

So again by stored do you mean displayed?

Have you added the fields to your member.html master template?

I hadn't added the fields to the member.html template. So now I have;

<perch:members type="text" id="dob" label="Date of Birth" listing="true" order="3" />

in member.html

and this in customer_create.html

<div class="form-group">
    <perch:label for="dob">Date of birth</perch:label>
    <perch:input class="form-control" type="text" id="dob" required="true" label="Date of Birth" placeholder="DD/MM/YY" />
    <perch:error for="dob" type="required">Please add your date of birth</perch:error>
</div>

The fields show in members, but are empty screen

I am getting the following error on the success page;

Warning: Cannot modify header information - headers already sent by (output started at /home/myserver/public_html/euromed/shop/success.php:5) in /home/myserver/public_html/euromed/perch/core/lib/PerchUtil.class.php on line 220

I've checked the success.php page and there is no white space at the start of the file which normally causes headers already sent errors.

Drew McLellan

Drew McLellan 2638 points
Perch Support

What's on shop/success.php at line 5?

Just some meta data

<meta http-equiv="X-UA-Compatible" content="IE=edge">

Just removed everything so I just have the following on my success.php;

<?php include('../perch/runtime.php'); ?>
<?php
  perch_shop_complete_payment('paypal-express');

  if (perch_shop_order_successful()) {
      echo '<h1>Thank you for your order!</h1>';
    }else{
      echo '<h1>Sorry!</h1>';
    }
?>

Which doesn't now error, but the DOB, College and Facebook fields are still empty

Hi Drew

I'm picking up on this from Friday.

I've currently got the following templates;

members/member.html

<perch:members type="text" id="first_name" label="First name" listing="true" order="1" />
<perch:members type="text" id="last_name" label="Last name" listing="true" order="2" />
<perch:members type="text" id="dob" label="Date of Birth" listing="true" order="3" />
<perch:members type="text" id="college_school" label="College School" listing="true" order="4" />
<perch:members type="text" id="facebook" label="facebook" listing="true" order="5" />

customer_create.html

<perch:form id="register" method="post" app="perch_shop" type="default">
<h2>New customer</h2>
    <div class="col-sm-6">
        <fieldset>
            <div class="form-group">
                <perch:label for="first_name">First name</perch:label>
                <perch:input class="form-control" type="text" id="first_name" required="true" label="First name" />
                <perch:error for="first_name" type="required">Please add your name</perch:error>
            </div>
            <div class="form-group">
                <perch:label for="last_name">Last name</perch:label>
                <perch:input class="form-control" type="text" id="last_name" required="true" label="Last name" />
                <perch:error for="last_name" type="required">Please add your name</perch:error>
            </div>
            <div class="form-group">
                <perch:label for="dob">Date of birth</perch:label>
                <perch:input class="form-control" type="text" id="dob" required="true" label="Date of Birth" placeholder="DD/MM/YY" />
                <perch:error for="dob" type="required">Please add your date of birth</perch:error>
            </div>
            <div class="form-group">
                <perch:label for="college_school">College / School</perch:label>
                <perch:input class="form-control" type="text" id="college_school" required="true" label="College / School"  />
                <perch:error for="college_school" type="required">Please add your School or College</perch:error>
            </div>
            <div class="form-group">
                <perch:label for="facebook">Facebook Profile</perch:label>
                <perch:input class="form-control" type="text" id="facebook"  label="Facebook Profile" placeholder="Enter Facebook profile url" />
            </div>
            <div class="form-group">
                <perch:label for="email">Email</perch:label>
                <perch:input class="form-control" type="email" id="email" required="true" placeholder="you@company.com" helper="PerchMembers_Members::check_email" />
                <perch:error for="email" type="required">Please add your email address</perch:error>
                <perch:error for="email" type="helper">That email address is already in use</perch:error>
            </div>
            <div class="form-group">
                <perch:label for="password">Create a password</perch:label>
                <perch:input class="form-control" type="password" id="password" required="true" match-with="password2" />
                <perch:error for="password" type="required">Please add a password</perch:error>
                <perch:error for="password" type="match">Passwords do not match</perch:error>
            </div>
            <div class="form-group">
                <perch:label for="password2">Type your password again</perch:label>
                <perch:input class="form-control" type="password" id="password2" required="true" />
                <perch:error for="password2" type="required">Please repeat your password</perch:error>
            </div>
        </fieldset>
    </div>

    <div class="col-sm-6">
        <fieldset>
            <div class="form-group">
                <perch:label for="company">Company</perch:label>
                <perch:input class="form-control" type="text" id="shipping_company" required="true" label="Company" />
            </div>
            <div class="form-group">
                <perch:label for="shipping_address_1">Address 1</perch:label>
                <perch:input class="form-control" type="text" id="address_1" required="true" label="Address 1" />
                <perch:error for="shipping_address_1" type="required">Please add the first line of your address</perch:error>
            </div>
            <div class="form-group">
                <perch:label for="shipping_address_2">Address 2</perch:label>
                <perch:input class="form-control" type="text" id="shipping_address_2" label="Address 2" />
            </div>
            <div class="form-group">
                <perch:label for="shipping_postcode">Postal code</perch:label>
                <perch:input class="form-control" type="text" id="shipping_postcode" required="true" label="Postal code" />
                <perch:error for="shipping_postcode" type="required">Please add your postcode</perch:error>
            </div>
            <div class="form-group">
                <perch:label for="shipping_city">City</perch:label>
                <perch:input class="form-control" type="text" id="shipping_city" label="City" />
            </div>
            <div class="form-group">
                <perch:label for="shipping_county">State or County</perch:label>
                <perch:input class="form-control" type="text" id="shipping_county" label="County" />
            </div>
            <div class="form-group">
                <perch:label for="shipping_country">Country</perch:label>
                <perch:input class="form-control" type="select" options="<perch:shop id="country_list" />" value="236" id="shipping_country" label="Country" />
            </div>
        </fieldset>
    </div>
    <div class="col-sm-12">
        <div class="form-group text-right">
            <perch:input class="btn btn-default" type="submit" value="Register" />
        </div>
    </div>
    <perch:success>
        <p>Thanks!</p>
    </perch:success>
</perch:form>

success.php

<?php include('../perch/runtime.php'); ?>
<?php
  perch_shop_complete_payment('paypal-express');

  if (perch_shop_order_successful()) {
      echo '<h1>Thank you for your order!</h1>';
    }else{
      echo '<h1>Sorry!</h1>';
    }
?>

The fields show in members, but are empty screen

Should the fields fill in from the customer_create form, or am I trying something that isn't possible?

EDIT: Adding the fields to the profile form and updating the fields on the members profile page works OK, its just the initial form when the customer is creating their account...

Hi Drew

I've tried adding perch_members to the form;

<perch:form id="register" method="post" app="perch_shop perch_members" type="default">

Still no joy. Do you have any suggestions I could try, as I'm running out of ideas to try...

Thanks Wayne