Forum

Thread tagged as: Question, Shop

Distinguish shipping and billing addresses in list template.

I'm using the default list template to display customer addresses on a confirmation page with perch_shop_customer_addresses();.

Is there a way to label the shipping and billing addresses in this template so a customer knows which is which?

Ta.

<perch:before>
<table class="table table-bordered">
</perch:before>
<tr>
    <th>
        <perch:shop id="addressFirstName" /> <perch:shop id="addressLastName" />
        <perch:if exists="addressCompany"><br /><perch:shop id="addressCompany" /></perch:if>
    </th>
    <td>
        <perch:if exists="address_1"><perch:shop id="address_1" /><br /></perch:if>
        <perch:if exists="address_2"><perch:shop id="address_2" /><br /></perch:if>
        <perch:if exists="city"><perch:shop id="city" /> <br /></perch:if>
        <perch:if exists="county"><perch:shop id="county" /> <br /></perch:if>
        <perch:if exists="postcode"><perch:shop id="postcode" /> <br /></perch:if>
        <perch:if exists="country_name"><perch:shop id="country_name" /></perch:if>
    </td>
    <td>
        <a href="/shop/addresses/<perch:shop id="addressID" />">Edit</a>
    </td>
</tr>
<perch:after>
</table>
</perch:after>
Mark Phoenix

Mark Phoenix 0 points

  • 5 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think any address can be used for either purpose, so there's not billing and shipping addresses at that point - just a list of recorded addresses.

I'm using the unaltered customer_create.html template which seems to designate a shipping & billing address.

<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>


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

        <div>
            <perch:label for="shipping_first_name">First name</perch:label>
            <perch:input type="text" id="shipping_first_name" required="true" label="First name" />
            <perch:error for="shipping_first_name" type="required">Please add your name</perch:error>
        </div>

        <div>
            <perch:label for="shipping_last_name">Last name</perch:label>
            <perch:input type="text" id="shipping_last_name" required="true" label="Last name" />
            <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" />
        </div>

        <div>
            <perch:label for="shipping_address_1">Address 1</perch:label>
            <perch:input type="text" id="shipping_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>
            <perch:label for="shipping_address_2">Address 2</perch:label>
            <perch:input type="text" id="shipping_address_2" label="Address 2" />
        </div>

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

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

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

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

    </fieldset>

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


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

</perch:form>
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. Have you checked <perch:showall /> to see what's available to you in the template?

Ah yes, addressTitle. Many thanks.

Thank you