Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / Require a referral code on signup?

Require a referral code on signup?

Locked

Views: 10,179

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
4 Jan 2008, 3:19 AM
#1
crunnells avatar

crunnells

New Zenner

Join Date:
Apr 2006
Posts:
9
Plugin Contributions:
0

Require a referral code on signup?

I'm not sure if this is in the right area, but I figure it's close.

I have a client who is starting up a new business, and she's getting a bunch of people to promote her product/site. I've added the Referral Code to the New Customer signup form, but it's not enough for her that it's there, she also wants it to be a required field (IE: I guess so people don't forget to fill it in. If they weren't referred by anyone, then they should enter "none" or something like that).

So my question is, how do I make the Referral Code a required field? Is that even possible?

4 Jan 2008, 1:08 PM
#2
madmumbler avatar

madmumbler

Zen Follower

Join Date:
Dec 2005
Location:
SWFL
Posts:
450
Plugin Contributions:
0

Re: Require a referral code on signup?

Disclaimer -- I'm not a programmer, so you'll need to put your head together with someone who is if you need more help.

I believe the file you have to edit is: includes/templates/template_default/templates/tpl_modules_create_account.php

You'd have to save it as includes/templates/CUSTOM/templates/tpl_modules_create_account.php

where CUSTOM is your template override folder.

You would need to add code to force the referral. (You'd need to set the switch in Configuration --> Customer Details too.)

The code referring to referrals is towards the bottom.

<?php
  if (CUSTOMERS_REFERRAL_STATUS == 2) {
?>
<fieldset>

<legend><?php echo TABLE_HEADING_REFERRAL_DETAILS; ?></legend>
<label class="inputLabel" for="customers_referral"><?php echo ENTRY_CUSTOMERS_REFERRAL; ?></label>
<?php echo zen_draw_input_field('customers_referral', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_referral', '15') . ' id="customers_referral"'); ?>
<br class="clearBoth" />
</fieldset>

Exactly WHAT you have to add -- I suggest looking at switches for other required fields, like name, etc. and using those to try it out.

And...If I'm totally wrong I'm sure someone will correct me. LOL (off to get more coffee...)

HTH,

4 Jan 2008, 1:10 PM
#3
madmumbler avatar

madmumbler

Zen Follower

Join Date:
Dec 2005
Location:
SWFL
Posts:
450
Plugin Contributions:
0

Re: Require a referral code on signup?

Oops -- meant to add you'll also want to edit the language file for that field so it says something like "Enter code or else enter NONE" or something like that so they don't get frustrated.

4 Jan 2008, 9:27 PM
#4
crunnells avatar

crunnells

New Zenner

Join Date:
Apr 2006
Posts:
9
Plugin Contributions:
0

Re: Require a referral code on signup?

Thanks for the tip, I've gotten that far, and I've got the form to look like it's required... But I was hoping someone knew precisely where the switch is to MAKE it required.

Any thoughts? I'll poke around with it, and post any findings I have, in case someone else needs the info later.

4 Jan 2008, 9:54 PM
#5
crunnells avatar

crunnells

New Zenner

Join Date:
Apr 2006
Posts:
9
Plugin Contributions:
0

Re: Require a referral code on signup?

Ok, so I found the javascript file that I need to change in /includes/modules/pages/create_account/jscript_form_check.php and I've added a new line at the bottom:

check_input("customers_referral", 0, "<?php echo ENTRY_CUSTOMERS_REFERRAL_ERROR; ?>");

Which should work... Except any changes I make the the file are ignored. I know I'm probably doing something wrong here, but I'm not sure what.

I've double-checked that it's going to the server, and I've tried adding comments to see if the changes are taking... I've even tried deleting everything in the file, and re-uploading it, and there are no changes to the login page.

Any thoughts? Thanks in advance.

4 Jan 2008, 10:05 PM
#6
crunnells avatar

crunnells

New Zenner

Join Date:
Apr 2006
Posts:
9
Plugin Contributions:
0

Re: Require a referral code on signup?

Ok, nevermind, I figured out why the changes weren't being reflected.

There are two sets of JS files. One here:

/includes/modules/pages/create_account/

and

/includes/modules/pages/login/

The page I was trying to change is actually the "login" page... So, that's sorted.

So, the Javascript requires the variable, but I don't think the store code requires is beyond that. If Javascript was disabled, they'd be able to pass thru without entering a referral code.

It's not ideal, but for simplicities sake, I'll leave it. The user has been told it's required, and Javascript forces it to be required. I think it might be enough.

4 Jan 2008, 10:12 PM
#7
crunnells avatar

crunnells

New Zenner

Join Date:
Apr 2006
Posts:
9
Plugin Contributions:
0

Re: Require a referral code on signup?

Quick change, here is the final Javascript code:

check_input("customers_referral", 4, "<?php echo ENTRY_CUSTOMERS_REFERRAL_ERROR; ?>");

Keep in mind, you should define ENTRY_CUSOMERS_REFERRAL_ERROR in the includes/languages/TEMPLATE/english.php file.

4 Jan 2008, 11:33 PM
#8
solarflare avatar

solarflare

Zen Follower

Join Date:
Sep 2006
Posts:
81
Plugin Contributions:
0

Re: Require a referral code on signup?

From my point it seems like /includes/modules/create_account.php stores the code you need to ensure it's entered beyond the JS.

In my version, line 68 has the referal code, you'll need to grab the conditional and error stuff from another field and whack it in there.

crunnells:

Ok, nevermind, I figured out why the changes weren't being reflected.

There are two sets of JS files. One here:

/includes/modules/pages/create_account/

and

/includes/modules/pages/login/

The page I was trying to change is actually the "login" page... So, that's sorted.

So, the Javascript requires the variable, but I don't think the store code requires is beyond that. If Javascript was disabled, they'd be able to pass thru without entering a referral code.

It's not ideal, but for simplicities sake, I'll leave it. The user has been told it's required, and Javascript forces it to be required. I think it might be enough.