Jump to content

Add a new entry when registering on the site


fabriceunko

Recommended Posts

I do not see a plugin for CC6.

There is, however, this: http://www.cubehelper.com/store608/custom-additional-registration-fields-v5-x.html

You may want to contact "CubeHelper" to ask if there is a possibility this this works on CC621. (And if it is encoded, to make sure it works with your version of PHP.)

Otherwise, an additional text entry field can be hard-coded into the codebase.

Link to comment
Share on other sites

Ok. Quick question -- do your current requirements make use of the "Title" text entry field as seen on the Registration form?

If so, we will go a different approach.

If not, maybe we can use that to store the birthdate.

 

Link to comment
Share on other sites

Ok. Let's deal with the Registration form first. The following edits relate to CC621 and the Foundation skin shipped with it.

content.register.php, find:

   <div class="row">
      <div class="small-12 large-8 columns"><label for="last_name" class="show-for-medium-up">{$LANG.user.name_last}</label><input type="text" name="last_name" id="last_name" value="{$DATA.last_name|capitalize}"  placeholder="{$LANG.user.name_last} {$LANG.form.required}" required></div>
   </div>

Add after:

<div class="row">
<div class="small-12 large-8 columns"><label for="birthdate" class="show-for-medium-up">{$LANG.user.birthdate}</label><input type="text" name="birthdate" id="birthdate" value="{$DATA.birthdate}"  placeholder="{$LANG.user.birthdate} {$LANG.form.required} YYYY-MM-DD" required class="date"></div>
</div>


Find:

<div class="hide" id="validate_lastname">{$LANG.account.error_lastname_required}</div>

Add after:

<div class="hide" id="validate_birthdate">{$LANG.account.error_birthdate_required}</div>

Note that there is a new language string.

/classes/user.class.php, function _load(), find:

foreach ($GLOBALS['hooks']->load('class.user.load') as $hook) include $hook;

Add after:

$GLOBALS['language']->addStrings(array('user'=>array('birthdate'=>'Birthdate')));
$GLOBALS['language']->addStrings(array('account'=>array('error_birthdate_required'=>'Birthdate required')));
skin file /js/3.cubecart.validate.js, find:

    $("#registration_form").validate({
        rules: {
            first_name: {
                required: true
            },
            last_name: {
                required: true
            },

Add after:

birthdate: {
    required: true,
    dateISO: true
},

Find a few lines later:

        messages: {
            first_name: {
                required: $('#validate_firstname').text()
            },
            last_name: {
                required: $('#validate_lastname').text()
            },

Add after:

birthdate: {
    required: $('#validate_birthdate').text()
},
/classes/user.class.php, function registerUser(), find:

		foreach ($GLOBALS['hooks']->load('class.user.register_user') as $hook) include $hook;

Add after:

if (empty($_POST['birthdate'])) {
	$GLOBALS['gui']->setError($GLOBALS['language']->account['error_birthdate_required']);
	$error['birthdate'] = true;
}

Finally, add the new column into the CubeCart_customer database table:

ALTER TABLE `CubeCart_customer` ADD `birthdate` DATE NOT NULL DEFAULT '0000-00-00';
ALTER TABLE `CubeCart_customer` ADD INDEX (`birthdate`);

The above just gets the data and databases it.

Later, we will add the means to add/show the new data in the administration Customer screen.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...