Forum

Thread tagged as: Problem, Members, Shop

Perch Shop Customers and Members

Hi All, I'm trying to register customers using the perch_shop_registration_form(); I've been able to get the form working, and it generates first_name, last_name, tel and email in my dynamic fields, but I can't seem to add any other dynamic fields and what's more... Only the first_name and last_name is passed to the members app. Is there a way of adding custom fields to this ? and have them appear in both Customers and Members ? or even just members ? any help would be greatly appreciated ! Thanks

Dylan Rynhart

Dylan Rynhart 0 points

  • 3 years ago

Dylan,

For this information to be available in members you will need to add the fields to perch/templates/members/member.html

You will also need to add the fields to perch/templates/members/forms/profile.html if you intend the member to be able to edit the data.

You will be able to recall the member data once saved with perch_member_get('myFancyNewField')

What have you done so far, and please post the templates so we can verify everything is ready to work.

Thanks

Hi Robert, Thanks for your reply, I've been trying this out in many ways, but essentially if I call

perch_shop_registration_form()

it uses the template members/forms/register.html and I have all myFancyNewFields in there. I also include all my new fields in the template: perch/templates/members/forms/profile.html But when I fill in the registration form, it adds all myFancyNewFields to the "perch2_shop_customers" table in my DB, but only adds "first_name" and "last_name" to the entry it creates in my "perch2_members" table in my DB.

If I adjust my "members/forms/register.html" template so that the form sends to both apps like this:

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

Then I get two new entries in my "perch2_members" table in my DB. One with all myFancyNewFields and one with just "first_name" and "last_name" created by the customers app.

The only solutions I can think of for this, would be to 1) find a way to register the two apps separately ? so I get the bespoke fields in both. I'm not sure if it's possible to register as a customer without populating the member app too ? 2) find a template that the perch_shop app uses to define what fields it populates the members app with, and edit that ? 3) populate the "perch2_shop_customers" table using PHP and bypassing Perch for this.

One thing I have discovered is that it seems that in this instance, the perch_shop app is not checking to see if there is already a member account with the provided email address before it adds the member. It only checks the customer database, which is fine if your not upgrading and have a ton of members already.

Any help with this would be mighty !!

Drew McLellan

Drew McLellan 2638 points
Perch Support

Members are just accounts for authentication. All the data is stored against the customer, with the minimum being passed over to Members. So no, your custom fields won't be added to the member.

Thanks Drew, So I'm assuming that the ideal situation is to store this info in "perch2_shop_customers". Is there any mechanism for generating customer accounts without a corresponding member account if one already exists ?

Drew McLellan

Drew McLellan 2638 points
Perch Support

No, there's nothing like that currently.