Forum

Thread tagged as: Problem, Members, Shop

Perch Shop / Members - Profile page not displaying all stored data

Hi,

I am using the Shop and Members app on a project.

The workflow I have at the moment is:

select product and add to cart if not logged in create profile (account) proceed to checkout payment

I have mainly used the 'Nest' demo files to build this solution and everything is working well.

However, during the profile creation stage (shop/checkout/customer_create.html) I enter all the details (standard items) such as member details, address etc.

This is all accepted and the transaction proceeds and upon returning to the checkout page, I can see that the new user is registerd and logged in.

If after the transaction (or whenever) I decide to 'view profile', only the Member details items are returned on the members/forms/profile.html page and none of the address details.

I have checked the DB and all of the address details are within the DB under the table 'perch3_shop_addresses'.

I've tried adding the perch_members app to the initial form, I've tried changing the form ID as well as a few other ideas, whilst trawling the forum for an answer.

I am sure I am missing something simple ?

I haven't tried adding just a seperate piece of data yet, i.e. D.O.B. as currently, I am trying to keep the templates standard so I can work out what is going on.

Any help is appreciated.

Diagnostics


Perch Runway: 3.0.8, PHP: 7.0.4, MySQL: mysqlnd 5.0.12-dev - 20150407 - $Id: f59eb767fe17a6679589b5c076d9fa88d3d4eac0 $, with PDO Server OS: WINNT, apache2handler Installed apps: content (3.0.8), assets (3.0.8), categories (3.0.8), perch_blog (5.5.1), perch_events (1.9.5), perch_forms (1.9), perch_shop_orders (1.2.1), perch_shop_products (1.2.1), perch_shop (1.2.1), perch_members (1.6.1), perch_twitter (3.7) App runtimes: <?php $apps_list = [ 'perch_blog', 'perch_twitter', 'perch_events', 'perch_forms', 'perch_members', 'perch_shop', ]; PERCH_LOGINPATH: /admin PERCH_PATH: C:\KDL-Projects\Open\kdl_anticoagulation\www\admin PERCH_CORE: C:\KDL-Projects\Open\kdl_anticoagulation\www\admin\core PERCH_RESFILEPATH: C:\KDL-Projects\Open\kdl_anticoagulation\www\admin\resources Image manipulation: GD PHP limits: Max upload 128M, Max POST 128M, Memory: 128M, Total max file upload: 128M F1: 0c66c2e1f82f9e0b7617b2cb8270f2c7 Resource folder writeable: Yes HTTP_HOST: auk.kdl DOCUMENT_ROOT: C:/KDL-Projects/Open/kdl_anticoagulation/www REQUEST_URI: /admin/core/settings/diagnostics/ SCRIPT_NAME: /admin/core/settings/diagnostics/index.php

customer_create.html

<perch:form id="register" method="post" app="perch_shop" type="shop" data-address-duplicate="true">
<section class="shop-content">
    <div class="container pb-medium">
        <div class="row">
            <div class="col-md-10 col-md-offset-1"> 
                <h1 class="x-large block pt-medium pb-medium text-center">Create Account</h1>

                <p class="small">* Required Fields</p>
                <div class="row">
                    <div class="col-md-6">
                        <h3 class="pb-small">New Member Details:</h3>
                        <div>
                            <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"><span class="error">Please add your name</span></perch:error>
                        </div>
                        <div>
                            <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"><span class="error">Please add your name</span></perch:error>
                        </div>
                        <div>
                            <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"><span class="error">Please add your email address</span></perch:error>
                            <perch:error for="email" type="helper"><span class="error">That email address is already in use</span></perch:error>
                        </div>
                        <div>
                            <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"><span class="error">Please add a password</span></perch:error>
                            <perch:error for="password" type="match"><span class="error">Passwords do not match</span></perch:error>
                        </div>

                        <div>
                            <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"><span class="error">Please repeat your password</span></perch:error>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <h3 class="pb-small">Address:</h3>          
                        <div>
                            <perch:label for="address_1">Address 1*</perch:label>
                            <perch:input class="form-control" type="text" id="address_1" required="true" label="Address 1" />
                            <perch:error for="address_1" type="required"><span class="error">Please add the first line of your address</span></perch:error>
                        </div>

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

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

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

                        <div>
                            <perch:label for="postcode">Postal code/Zip code*</perch:label>
                            <perch:input class="form-control" type="text" id="postcode" label="Postal code" />
                            <perch:error for="postcode" type="required"><span class="error">Please add your postcode/zipcode</span></perch:error>
                        </div>

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





                <perch:if id="shipping_weight" match="gt" value="0.00">
                <div class="row">
                    <div class="col-md-6">
                        <h3 class="pb-small">Shipping address:</h3>
                        <div>
                            <perch:label for="shipping_first_name">First name</perch:label>
                            <perch:input class="form-control" type="text" id="shipping_first_name" label="First name" />
                            <perch:error for="shipping_first_name" type="required"><span class="error">Please add your name</span></perch:error>
                        </div>

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

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

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

                        <div>
                            <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>
                            <perch:label for="shipping_city">City</perch:label>
                            <perch:input class="form-control" type="text" id="shipping_city" label="City" />
                        </div>

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


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

                        <div>
                            <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>
                    </div>
                </div>
                </perch:if>

                <!--<h3 class="pb-small">Register:</h3>-->
                <div class="mt-medium text-center">
                    <perch:input type="submit"  class="btn btn-remove-cart btn small hvr-sweep-to-right" value="Continue" />
                </div>


                <!--<perch:success>
                    <p>Thanks you for becoming a Member ????</p>
                </perch:success>-->

            </div>
        </div>
    </div>
</section>
</perch:form>

profile.html

<perch:form id="register" method="post" app="perch_shop" type="shop" data-address-duplicate="true">
<section class="shop-content">
    <div class="container pb-medium">
        <div class="row">
            <div class="col-md-10 col-md-offset-1"> 
                <h1 class="x-large block pt-medium pb-medium text-center">Create Account</h1>

                <p class="small">* Required Fields</p>
                <div class="row">
                    <div class="col-md-6">
                        <h3 class="pb-small">New Member Details:</h3>
                        <div>
                            <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"><span class="error">Please add your name</span></perch:error>
                        </div>
                        <div>
                            <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"><span class="error">Please add your name</span></perch:error>
                        </div>
                        <div>
                            <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"><span class="error">Please add your email address</span></perch:error>
                            <perch:error for="email" type="helper"><span class="error">That email address is already in use</span></perch:error>
                        </div>
                        <div>
                            <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"><span class="error">Please add a password</span></perch:error>
                            <perch:error for="password" type="match"><span class="error">Passwords do not match</span></perch:error>
                        </div>

                        <div>
                            <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"><span class="error">Please repeat your password</span></perch:error>
                        </div>
                    </div>

                    <div class="col-md-6">
                        <h3 class="pb-small">Address:</h3>          
                        <div>
                            <perch:label for="address_1">Address 1*</perch:label>
                            <perch:input class="form-control" type="text" id="address_1" required="true" label="Address 1" />
                            <perch:error for="address_1" type="required"><span class="error">Please add the first line of your address</span></perch:error>
                        </div>

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

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

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

                        <div>
                            <perch:label for="postcode">Postal code/Zip code*</perch:label>
                            <perch:input class="form-control" type="text" id="postcode" label="Postal code" />
                            <perch:error for="postcode" type="required"><span class="error">Please add your postcode/zipcode</span></perch:error>
                        </div>

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





                <perch:if id="shipping_weight" match="gt" value="0.00">
                <div class="row">
                    <div class="col-md-6">
                        <h3 class="pb-small">Shipping address:</h3>
                        <div>
                            <perch:label for="shipping_first_name">First name</perch:label>
                            <perch:input class="form-control" type="text" id="shipping_first_name" label="First name" />
                            <perch:error for="shipping_first_name" type="required"><span class="error">Please add your name</span></perch:error>
                        </div>

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

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

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

                        <div>
                            <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>
                            <perch:label for="shipping_city">City</perch:label>
                            <perch:input class="form-control" type="text" id="shipping_city" label="City" />
                        </div>

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


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

                        <div>
                            <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>
                    </div>
                </div>
                </perch:if>

                <!--<h3 class="pb-small">Register:</h3>-->
                <div class="mt-medium text-center">
                    <perch:input type="submit"  class="btn btn-remove-cart btn small hvr-sweep-to-right" value="Continue" />
                </div>


                <!--<perch:success>
                    <p>Thanks you for becoming a Member ????</p>
                </perch:success>-->

            </div>
        </div>
    </div>
</section>
</perch:form>
Andrew Kennedy

Andrew Kennedy 0 points

  • 4 years ago

Andrew, the addresses are save by the perch_shop app therefore you must query the addresses from the shop app using

perch_shop_customer_addresses()

Thanks Robert that's great.

I will play around (hopefully this weekend) and see how I get on.

Shame that we can capture ALL the data from customer_create within the shop, yet only return some of the data from the profile template in members.

I've just had a quick go actually now.

First issue is that if I use a different template to the provided list.html, runway errors that if cannot find it.

So, using:

perch_shop_customer_addresses([
    'template' => 'address_profile.html'
]);

I get an error that the template cannot be found. 'address_profile.html' is in the same shop/addresses folder as list.html.

So, moving on and directly editing list.html, what would actually make sense in the profile page for the user is to return the data within input fields, so that it can ALL be edited and saved, i.e. the user might want to change their email address, second line of their physical address and let's say another item that is purely drivem from the profile page, such as DOB, i.e. not collected by customer_create during the shop registration process.

I was hoping I could change:

<perch:shop id="address_1" />

to something like:

<perch:shop class="form-control" type="text" id="address_1" required="true" label="Address 1" />

to actually make the data returned useful to the user, rather than just rendering it to screen and having to visit some other page, which seems to fail.

<a href="/shop/addresses/<perch:shop id="addressID" />/">Edit</a>

I have not set-up a page for this in the admin area as I have no idea what template to use and call.

I need to look through the Perch docs a bit more. Just found

perch_shop_customer_address()

though I am presuming this will just return the first address and as such, have all the same problems as above.

Time to sleep on it and have another look tomorrow.

Thanks,

Andy

Yes, as expected:

perch_shop_customer_address(1, [
    'template' => 'address_profile.html'
]);

does not return / find the template. DEBUG is telling me that the template cannot be found.

Seems like a bug ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Which template is it saying can't be found? What path is it looking for and how does that differ from the path you're giving it?

Hi Drew,

If I create just a copy of list.html (C:\Projects\Open\mysite\www\admin\templates\shop\addresses) and copy and save it in the same location as: address_profile.html

Then using the below within my profile.php page:

perch_shop_customer_addresses([
    'template' => 'address_profile.html'
]);

I get the error:

Template file not found: C:\Projects\Open\mysite\www\admin\addons\apps\perch_shop\templates\shop\address_profile.html

Which, now looking at it in the cold light of day (and not late on a weekend), I can see that the paths are DIFFERENT..sorry.

However, saving address_profile.html in the folder shown in the DEBUG, still returns exactly the same error message about the path and template not being found.

But why would the perch code not look in the same place as the list.html file, as all of the templates were copied out of the add-ons directory and placed within admin/templates, as is the standard practice.

Sorry, had code blindness on the path previously. It's just been a real struggle with all of this.

Mind you, even getting another template doesn't resolve the MAIN ISSUE, which is how you present 'editable' data to the profile page, be it address data and/or further profile data to allow the member to edit/update their details.

It's how you turn:

<perch:if exists="address_1"><perch:shop id="address_1" /><br /></perch:if>

into something like:

<perch:input class="form-control" type="text" id="product" id="address_1" required="true" value="<perch:shop id="address_1" />" />

Thanks,

Andy

Drew McLellan

Drew McLellan 2638 points
Perch Support

You would need to specify the template as:

'addresses/address_profile'

I believe.

Thanks Drew, that's great. I should have persisted in all the different permutations I was trying.

How do I open this data up for editing capabilities.

I've tried

<perch:input class="form-control" type="text" id="product" id="address_1" required="true" value="<perch:shop id="address_1" />" />

but no joy.

Any ideas or a push in the correct direction would be appreciated.

Drew McLellan

Drew McLellan 2638 points
Perch Support

Do I understand that you've added fields to the customer, but now want to edit them as part of an address?

Not quite.

Firstly I would like to return the member/customer details to the profile page, but allow them to be editable.

Secondly, if I wanted to also have data that was seperate to the initial member/registration details that are currently on the profile page (first name, second name, email address), how would I add them, i.e. if when they register via the shop I wanted to make the process simple (name, email, password, address) to expedite the transcation, but then once registered, I could get them to fill in more details about themselves on the profile page, be it customer details (D.O.B.) or preferences (interests etc) which could ultimately be used later to help drive specific content, newlsetters et al, or just to allow the client to get a better understanding of their memebers.

Hope this makes sense ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

Ok. Which part are you having problems with, and what are the problems?

All of it.

Issue 1: If I return the address captured by customer_create.html by using perch_shop_customer_addresses() on the profile.html template, this will just render an uneditable tabulated entry of the submitted address data...as is the standard template.

However, I would like to return the data in an editable 'form' format, in the same way first_name etc is returned in the profile.html page.

Example:

customer_create.html

<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 a your name</perch:error>
~~~

profile.html
~~~
<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 a your name</perch:error>
~~~

I can use the same code to return the data in an editable format.

But, if I want to do the same for address_1 for example, I initially applied the same logic, where:

customer_create.html

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


addresses.html

<perch:label for="address_1">Address 1*</perch:label> <perch:input class="form-control" type="text" id="address_1" required="true" label="Address 1" value="<perch:shop id="address_1" />" /> <perch:error for="address_1" type="required"><span class="error">Please add the first line of your address</span></perch:error> ~~~ But this will not return a populated input box.

I'm wondering if I would have to pass all the address details into the profile.html template as a series of variables.