Zen Cart Logo
Forums / General Questions / adding radio buttons to creat account

adding radio buttons to creat account

Views: 1,101

Results 1 to 9 of 9
19 Jun 2012, 8:33 PM
#1
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

adding radio buttons to creat account

I think that I'm a half inch away from getting this right! I used the email format but since that is a radio button dependent on a config setting to start with, maybe I've got stuff I don't need here. (this may well show my php ignorance - I hate to have to ask!)

Here's the button from the tpl_modules_create_account.php:

<?php echo zen_draw_radio_field('customers_resident', 'Yes', ($customers_resident == 'yes' ? true : false),'id="resident_yes"') . '<label class="radioButtonLabel" for="resident_yes">' . ENTRY_SEND_DOC_YES . '</label>' . zen_draw_radio_field('customers_resident', 'NO', ($customers_resident == 'No' ? true : false), 'id="resident_no"') . '<label class="radioButtonLabel" for="resident_no">' . ENTRY_SEND_DOC_NO. '</label>'; ?>

I also tried leaving out the ($customers_resident == 'yes' ? true : false) on both buttons like this:

<?php echo zen_draw_input_field('customers_resident', htmlspecialchars($cInfo->customers_resident, ENT_COMPAT, CHARSET, TRUE), zen_set_field_length(TABLE_CUSTOMERS, 'customers_resident', 50), true) ; ?>

and from the module create account just this since it's not dependent on a config setting like the email format:

$customers_resident = zen_db_prepare_input($_POST['customers_resident']);

and added to the data array:
'customers_resident' => $customers_resident,

I've added in quite a few new fields and everything works except the radio buttons (I have three sets of them). Nothing is getting put into the database but not even the defaults are left. So it looks like nothing is being posted from the create account form - ie, radio buttons aren't working!

19 Jun 2012, 9:16 PM
#2
lat9 avatar

lat9

Administrator

Join Date:
Sep 2009
Location:
Stuart, FL
Posts:
14,068
Plugin Contributions:
56

Re: adding radio buttons to creat account

Do you, by any chance, use the Super Globals plugin? It's minimally invasive and will display a wealth of information (like the values returned in the POST and GET arrays as well is internal variable values) to allow you to debug this kind of stuff.

19 Jun 2012, 9:18 PM
#3
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: adding radio buttons to creat account

but you wrote it for 1.5 - this is a 1.3.9h cart

20 Jun 2012, 1:28 PM
#4
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: adding radio buttons to creat account

I finally got all this straighened out - it was all about misspellings in different places, not about the php. So glad I'm having vision surgery soon!

27 Sep 2012, 1:54 PM
#5
elmick avatar

elmick

New Zenner

Join Date:
Sep 2012
Posts:
10
Plugin Contributions:
0

Re: adding radio buttons to creat account

Hi, I too am trying to add a couple of radio buttons to the login page (that request a simple Yes/No answer to a question). I could not follow exactly what this process entails. Could one of you guys simplify the stages for a new-coder like me?

27 Sep 2012, 2:47 PM
#6
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: adding radio buttons to creat account

That's a big order. I'm no newbie at all and I had some difficulty picking my way thru this. Essentially what i did was take an existing set of radio buttons (the mr, ms or the html/email) and replacing the identifying bits with new terms. I went wrong when I misspelled something.

You make changes in the includes/templates/your template/tpl_modules_create_account.php and includes/modules/create_account.php.

Of course, you also add the corresponding new field to the customers table in the database.

Not really a job for a newbie. There is a plugin that might be easier for you to fool with in the plugins section. I haven't used it myself: http://www.zen-cart.com/downloads.php?do=file&id=1137

27 Sep 2012, 2:51 PM
#7
elmick avatar

elmick

New Zenner

Join Date:
Sep 2012
Posts:
10
Plugin Contributions:
0

Re: adding radio buttons to creat account

Cripes! Thanks, I will have a play. Regards.

28 Sep 2012, 5:10 PM
#8
elmick avatar

elmick

New Zenner

Join Date:
Sep 2012
Posts:
10
Plugin Contributions:
0

Re: adding radio buttons to creat account

Delia that link you sent me did the job for me. After a few problems (my own fault) I managed to install 4 fields on my login page. I even think I can convert these to radio buttons but have made do for the present.

28 Sep 2012, 5:12 PM
#9
delia avatar

delia

Totally Zenned

Join Date:
May 2006
Location:
Gardiner, Maine
Posts:
2,383
Plugin Contributions:
7

Re: adding radio buttons to creat account

great - always check the mods - if they are recent, they probably work. If they aren't recent, sometimes you can find threads about them and be able to find out if there were/are problems with your version.