Forum

Thread tagged as: Question, Problem, Shop

Checkout Perch Shop

I'm having a lot of difficulty with perch and the checkout. I''m using paypal as a gateway and I don't understand why it's currently not importing the address. On my checkout page I have the following:

<?php 
if (perch_member_logged_in()) {

  // your 'success' return URL
  $return_url = 'https://tsm.web-design.wales/order-complete.php';
  $cancel_url = 'https://tsm.web-design.wales/cancel.php';
  perch_shop_checkout('paypal-express', [
    'return_url' => $return_url,
    'cancel_url' => $cancel_url,
  ]);


}else
{
    perch_members_login_form();

}
?>

The login form:


<div class="col-sm-6"> <div class="form-card"> <h4>New Customers</h4> <p>By creating an account with our store, you will be able to move through the checkout process faster, view your current orders and previous orders in your account and more.</p> <div><a href="create-account.php" class="add-to-cart button nomargin">Create An Account</a></div> </div> </div> <div class="col-sm-6"> <div class="form-card"> <h4>Registered Customers</h4> <p>If you have an account with us, please log in.</p> <perch:form id="login" method="post" app="perch_members" class="account-create"> <perch:error for="all" type="login"> <p class="error" style="color: red;">Sorry! Those details do not match our records.</p> </perch:error> <perch:label for="email">Email</perch:label> <perch:input type="email" id="email" required="true" label="Email" class="form-control input-lg" /> <perch:error for="email" type="required">Required</perch:error> <perch:error for="email" type="format">Check format of address</perch:error> <perch:label for="password">Password</perch:label> <perch:input type="password" id="password" required="true" label="Password" class="form-control input-lg" /> <perch:error for="password" type="required">Required</perch:error> <div> <br> <perch:input type="submit" id="submit" value="Log in" class="add-to-cart button nomargin" /> <br> <perch:input type="hidden" id="r" /> <span class="required-text">* Required Fields</span></div> <div class="back"><a href="reset.php">Forgot Your Password?</a></div> </perch:form> </div> </div> ~~~ Create an account form:
                        <perch:form id="register" method="post" app="perch_shop" class="account-create">
<legend>Personal Information</legend>


<fieldset>

    <div>
        <perch:label for="first_name">First name<span class="required">*</span></perch:label>
        <perch:input type="text" id="first_name" required="true" label="First name" class="form-control input-lg"/>
        <perch:error for="first_name" type="required">Please add your name</perch:error>
    </div>

    <div>
        <perch:label for="last_name">Last name<span class="required">*</span></perch:label>
        <perch:input type="text" id="last_name" required="true" label="Last name" class="form-control input-lg"/>
        <perch:error for="last_name" type="required">Please add your name</perch:error>
    </div>

    <div>
        <perch:label for="email">Email<span class="required">*</span></perch:label>
        <perch:input type="email" id="email" required="true" placeholder="you@company.com" helper="PerchMembers_Members::check_email" class="form-control input-lg"/>
        <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<span class="required">*</span></perch:label>
        <perch:input type="password" id="password" required="true" match-with="password2" class="form-control input-lg"/>
        <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<span class="required">*</span></perch:label>
        <perch:input type="password" id="password2" required="true" class="form-control input-lg"/>
        <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"  class="form-control input-lg"/>
    </div>-->

    <div>
        <perch:label for="address_1">Address 1<span class="required">*</span></perch:label>
        <perch:input type="text" id="address_1" required="true" label="Address 1" class="form-control input-lg"/>
        <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" class="form-control input-lg"/>
    </div>

    <div>
        <perch:label for="postcode">Postal code</perch:label>
        <perch:input type="text" id="postcode" label="Postal code" class="form-control input-lg"/>
    </div>

    <div>
        <perch:label for="city">City</perch:label>
        <perch:input type="text" id="city" label="City" class="form-control input-lg" />
    </div>

    <div>
        <perch:label for="county">County</perch:label>
        <perch:input type="text" id="county" label="County" class="form-control input-lg" />
    </div>

    <div>
        <perch:label for="country">Country</perch:label>
        <perch:input type="text" id="country" label="Country" class="form-control input-lg"/>
    </div>

</fieldset>


<fieldset>
    <legend>Shipping address</legend>

    <div>
        <perch:label for="shipping_first_name">First name<span class="required">*</span></perch:label>
        <perch:input type="text" id="shipping_first_name" required="true" label="First name" class="form-control input-lg"/>
        <perch:error for="shipping_first_name" type="required">Please add your name</perch:error>
    </div>

    <div>
        <perch:label for="shipping_last_name">Last name<span class="required">*</span></perch:label>
        <perch:input type="text" id="shipping_last_name" required="true" label="Last name" class="form-control input-lg"/>
        <perch:error for="shipping_last_name" type="required">Please add your name</perch:error>
    </div>


    <div>
        <perch:label for="company">Company</perch:label>
        <perch:input type="text" id="shipping_company" label="Company" class="form-control input-lg"/>
    </div>

    <div>
        <perch:label for="shipping_address_1">Address 1<span class="required">*</span></perch:label>
        <perch:input type="text" id="shipping_address_1" required="true" label="Address 1" class="form-control input-lg"/>
        <perch:error for="shipping_address_1" type="required">Please add the first line of your address</perch:error>
    </div>

    <div>
        <perch:label for="shipping_address_2">Address 2</perch:label>
        <perch:input type="text" id="shipping_address_2" label="Address 2" class="form-control input-lg"/>
    </div>

    <div>
        <perch:label for="shipping_postcode">Postal code</perch:label>
        <perch:input type="text" id="shipping_postcode" label="Postal code" class="form-control input-lg"/>
    </div>

    <div>
        <perch:label for="shipping_city">City</perch:label>
        <perch:input type="text" id="shipping_city" label="City" class="form-control input-lg"/>
    </div>

    <div>
        <perch:label for="shipping_county">County</perch:label>
        <perch:input type="text" id="shipping_county" label="County" class="form-control input-lg"/>
    </div>

    <div>
        <perch:label for="shipping_country">Country</perch:label>
        <perch:input type="text" id="shipping_country" label="Country" class="form-control input-lg"/>
    </div>

</fieldset>

    <div>
        <perch:input type="submit" value="Register" class="add-to-cart button" />
        <span class="required-text">* Required Fields</span>
    </div>


<perch:success>
    <h4>Thank you for registering!</h4>
    <br>
    <a class="add-to-cart button" href="cart.php">Back to checkout</a>
</perch:success>

</perch:form>
~~~

Can anyone please help?! The name and email pulls through to paypal great, why is the address not working?!

Jade Marling

Jade Marling 0 points

  • 3 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Importing the address to PayPal? I don't think we ever send it to PayPal.

So when the site redirects to paypal on pay the address is supposed to be prefilled with 0? [Screenshot] (https://walesairambulance.com/images/error.png)

Also the address is not appearing on the confirmation email. (https://walesairambulance.com/images/error2.png)

Drew McLellan

Drew McLellan 2638 points
Perch Support

That's not a screen I'm familiar with. Is it on paypal.com?

Yes, but it's not coming through on anything. (https://walesairambulance.com/images/error3.png)

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you tried with the default templates?