fabriceunko Posted August 7, 2018 Share Posted August 7, 2018 How to Add a new entry when registering on the site. I would like my customers when they register on my site must indicate their date of birth (mandatory) Link to comment Share on other sites More sharing options...
bsmither Posted August 7, 2018 Share Posted August 7, 2018 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 More sharing options...
fabriceunko Posted August 8, 2018 Author Share Posted August 8, 2018 hello, thank you for the link but I can not contact cubehelper because on his site the captcha does not work because it uses version 1 and this one says it's shutdown Link to comment Share on other sites More sharing options...
bsmither Posted August 8, 2018 Share Posted August 8, 2018 I guess we will just have to hard-code the one extra field into the system. Are you ready? Link to comment Share on other sites More sharing options...
fabriceunko Posted August 9, 2018 Author Share Posted August 9, 2018 yes Link to comment Share on other sites More sharing options...
bsmither Posted August 9, 2018 Share Posted August 9, 2018 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 More sharing options...
fabriceunko Posted August 9, 2018 Author Share Posted August 9, 2018 yes currently I use the title field as it is in the basic form Link to comment Share on other sites More sharing options...
bsmither Posted August 9, 2018 Share Posted August 9, 2018 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 More sharing options...
fabriceunko Posted August 10, 2018 Author Share Posted August 10, 2018 thank you I'll see all this against I'm in cubecart 622 Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.