How to make customer referral a required field during create account?
I have tried the below updates to make the customers referral a required field. I do have the admin set to 2. The create account page looks correct but it does not actually force the customer to enter text (as in it really is not required)
What I have done so far is:
/includes/languages/YOUR_CUSTOM/english.php
added:
define('ENTRY_CUSTOMERS_REFERRAL_ERROR', 'Please enter who or how you were referred to our site');
define('ENTRY_CUSTOMERS_REFERRAL_TEXT', '*');
/includes/templates/YOUR_CUSTOM/templates/tpl_modules_create_account.php
update to:
<fieldset>
<legend><?php echo TABLE_HEADING_REFERRAL_DETAILS; ?></legend>
<label class="inputLabel" for="customers_referral"><?php echo ENTRY_CUSTOMERS_REFERRAL; ?></label>
<?php
//orig line echo zen_draw_input_field('customers_referral', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_referral', '50') . ' id="customers_referral"');
echo zen_draw_input_field('customers_referral', '', zen_set_field_length(TABLE_CUSTOMERS, 'customers_referral', '50') . ' id="customers_referral"') . (zen_not_null(ENTRY_CUSTOMERS_REFERRAL_TEXT) ? '<span class="alert">' . ENTRY_CUSTOMERS_REFERRAL_TEXT . '</span>': '');
?>
<br class="clearBoth" />
</fieldset>
/includes/modules/YOUR_CUSTOM/create_account.php
//added below to make referral comment required
if (strlen($customers_referral) < 4) {
$error = true;
$messageStack->add('create_account', ENTRY_CUSTOMERS_REFERRAL_ERROR);
}
/includes/modules/pages/create_account/jscript_form_check.php
add:
<?php if ((int)ENTRY_CUSTOMERS_REFERRAL > 0) { ?>
check_input("customers_referral", <?php echo ENTRY_CUSTOMERS_REFERRAL; ?>, "<?php echo ENTRY_CUSTOMERS_REFERRAL_ERROR; ?>");
What might I be doing wrong? Thanks
ZC 1.5.5
Add ons: - Column/Grid 1.3.8 - Dual pricing 1.7 - ImageHandler3