Forum

Thread tagged as: Problem, Shop

Missing Address from Shop Order

Hi,

I have the following setup for my Shop...

Prospective customer fills in the customer_create.html form, which is then set to Pending in Members so it has to be approved before they get access to the shop. This is the form, called with perch_shop_registration_form();:

<div class="container">
<perch:form id="register" method="post" app="perch_shop">

    <h2>New customer</h2>


    <fieldset>
        <legend>About you</legend>
        <div>
            <perch:label for="first_name">First name</perch:label>
            <perch:input 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>
            <perch:label for="last_name">Last name</perch:label>
            <perch:input 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>
            <perch:label for="email">Email</perch:label>
            <perch:input 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>
            <perch:label for="password">Create a password</perch:label>
            <perch:input 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>
            <perch:label for="password2">Type your password again</perch:label>
            <perch:input type="password" id="password2" required="true" />
            <perch:error for="password2" type="required">Please repeat your password</perch:error>
        </div>
    </fieldset>

    <fieldset>
        <legend>Billing address</legend>
        <div>
            <perch:label for="company">Company</perch:label>
            <perch:input type="text" id="company" label="Company" />
        </div>

        <div>
            <perch:label for="address_1">Address 1</perch:label>
            <perch:input type="text" id="address_1" required="true" label="Address 1" />
            <perch:error for="address_1" type="required">Please add the first line of your address</perch:error>
        </div>

        <div>
            <perch:label for="address_2">Address 2</perch:label>
            <perch:input type="text" id="address_2" label="Address 2" />
        </div>

        <div>
            <perch:label for="postcode">Postal code</perch:label>
            <perch:input type="text" id="postcode" label="Postal code" />
        </div>

        <div>
            <perch:label for="city">City</perch:label>
            <perch:input type="text" id="city" label="City" />
        </div>

        <div>
            <perch:label for="county">State or County</perch:label>
            <perch:input type="text" id="county" label="County" />
        </div>

        <div>
            <perch:label for="country">Country</perch:label>
            <perch:input type="select" options="<perch:shop id="country_list" />" value="236" id="country" label="Country" />
        </div>

    </fieldset>

        <div>
            <perch:input type="submit" value="Register" />
        </div>


    <perch:success>
        <p>Thanks!</p>
    </perch:success>

</perch:form>
</div>

This seems to work ok - once the member is approved they can then log in using perch_members_login_form();, for which I am using the standard template.

The issue is when an order is placed. The order appears in Perch, but with just the customer name in the Billing Address and Shipping Address sections. When I look in the database for the address the addressDynamicFields looks like this:

{"first_name":"Michael","last_name":"Harrison","address_1":false,"address_2":false,"postcode":false,"country":false,"company":false,"city":false,"customer":"996","phone":false,"county":false,"instructions":false}

When in Perch the error showing in Debug is No country set for address, but from the above I would guess the problem is more serious as none of the address seems to have been set.

If I untick New members require approval (so the customer is immediately logged in on form submission), the billing address shows in Perch but the Shipping address is blank apart from the customer name.

I need to have the approval step, and the ideal is the one address used at registration to be used for Shipping and Billing. What can you suggest to fix the addresses issue?

Thanks as always

Mike

P.S. This is my diagnostics:

Perch Runway: 2.8.32, PHP: 5.6.27, MySQL: mysqlnd 5.0.11-dev - 20120503 - $Id: 76b08b24596e12d4553bd41fc93cccd5bac2fe7a $, with PDO
Server OS: Darwin, apache2handler
Installed apps: content (2.8.32), assets (2.8.32), categories (2.8.32), perch_forms (1.8.3), perch_shop_orders (1.0.10), perch_shop_products (1.0.10), perch_shop (1.0.10), perch_members (1.5), perch_mailchimp (3.0.1)
App runtimes: <?php $apps_list = array( 'content', 'categories', 'perch_forms', 'perch_mailchimp', 'perch_members', 'perch_shop' );
PERCH_LOGINPATH: /admin
PERCH_PATH: /Volumes/Data/g Websites/newgatetrade/newgate-trade/admin
PERCH_CORE: /Volumes/Data/g Websites/newgatetrade/newgate-trade/admin/core
PERCH_RESFILEPATH: /Volumes/Data/g Websites/newgatetrade/newgate-trade/admin/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: newgatetrade.dev
DOCUMENT_ROOT: /Volumes/Data/g Websites/newgatetrade/newgate-trade
REQUEST_URI: /admin/core/settings/diagnostics/
SCRIPT_NAME: /admin/core/settings/diagnostics/index.php
Mike Harrison

Mike Harrison 37 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

So is the scenario that you're allowing pending members to purchase? I don't think that's going to work.

Hi Drew,

Only approved members can access the site to place an order. The whole site has a logged in conditional in the header which sends visitors back to the login form if they aren't logged in. The issue above is when an approved member is placing an order

Drew McLellan

Drew McLellan 2638 points
Perch Support

Where do the pending members come into it?

I just thought that me adding that to the process (rather than a more standard automatic approval as you would with a standard online shop) might be where the issue with the addresses was coming from

Hi Drew have you had a chance to look at this? I could do with getting the process working:

1) Potential customer fills in customer_create.html, called with perch_shop_registration_form();. This is set to requires approval in the Members app in Perch

2) Customer appears as pending in Members, and is then approved by Admin

3) Once approved, customer can log in to the site and place an order

4) The order generated uses the address submitted in step 1 as both Billing and Shipping address

At the moment I still have no addresses at all showing in the order, using the process above. If I remove the requires approval part and log the customer straight in I get a Billing Address but no Shipping Address

I should add that I am using Manual checkout, so the customer is completing the order without adding any additional information. They view the Cart which has a Place Order button, which when clicked goes to /checkout for manual payment and then on to success automatically. Is the issue that I need to set the address somewhere?

Drew McLellan

Drew McLellan 2638 points
Perch Support

As far as I'm concerned that should work. I can't see any problem with that process.

How did you go with this Mike? Are you available for freelance work? Think I'm going to need help finishing Perch Shop websites for a bit until I have some more resources to use. Please email me brad@webrad.co ;)

Hi Brad,

It sorta works - got the signup process all working, just missing the ability for the customer to add / alter addresses post-registration. That feature isn't actually required for the build (though would be nice!) so not spent any further time on it.

Will pop you an email.

Mike