Christopher Short Posted June 21, 2017 Share Posted June 21, 2017 How can I require a phone number for customers? Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted June 21, 2017 Share Posted June 21, 2017 As I understand it this should already be required. This is one place in the content.register.php file: <div class="row"> <div class="small-12 large-8 columns"><label for="phone" class="show-for-medium-up">{$LANG.address.phone}</label><input type="text" name="phone" id="phone" value="{$DATA.phone}" placeholder="{$LANG.address.phone} {$LANG.form.required}" required></div> </div> {$LANG.form.required}" required> should control that. Quote Link to comment Share on other sites More sharing options...
havenswift-hosting Posted June 21, 2017 Share Posted June 21, 2017 41 minutes ago, Dirty Butter said: As I understand it this should already be required. This is one place in the content.register.php file: {$LANG.form.required}" required> should control that. That of course depends on what skin you are using but do check that file to see if your skin has that code Quote Link to comment Share on other sites More sharing options...
Will Shaman Posted August 17, 2017 Share Posted August 17, 2017 As I understand it this should already be required. This is one place in the content.register.php file: <div class="row"> <div class="small-12 large-8 columns"><label for="phone" class="show-for-medium-up">{$LANG.address.phone}</label><input type="text" name="phone" id="phone" value="{$DATA.phone}" placeholder="{$LANG.address.phone} {$LANG.form.required}" required></div> </div> {$LANG.form.required}" required> should control that. Hi Dirty Butter — long time no see! Hope you're fine and dandy. Would it be possible to alter this line so that a phone number is NOT required? What would be the magic incantation to use? (I don't mind giving people the option to enter their phone if desired — I just don't want it to be obligatory). Thanks in advance, Will Quote Link to comment Share on other sites More sharing options...
ayz1 Posted August 17, 2017 Share Posted August 17, 2017 you could try <div class="row"> <div class="small-12 large-8 columns"><label for="phone" class="show-for-medium-up">{$LANG.address.phone}</label><input type="text" name="phone" id="phone" value="{$DATA.phone}" placeholder="{$LANG.address.phone}"></div> </div> Quote Link to comment Share on other sites More sharing options...
Will Shaman Posted August 17, 2017 Share Posted August 17, 2017 (edited) Thanks very much for your speedy reply, ayz1. I replaced the code as you suggested, then cleared image, language, SQL and regular caches in Maintenance area of Admin Dashboard. I also cleared my browser's cache, but I'm still required to enter a phone number (although the placeholder text "(Required)" no longer shows). As your suggestion is the equivalent to removing the bit of code reading… {$LANG.form.required}" required …I can only assume there's some code elsewhere making this required as well. The labyrinthine network of PHP files that constitutes CubeCart is too obtuse for a simple guy like me, so I can't even begin to tell how to trace where this is coming from. Any more clues? Thanks in advance and best wishes, Will Edited August 17, 2017 by Will Shaman Quote Link to comment Share on other sites More sharing options...
ayz1 Posted August 17, 2017 Share Posted August 17, 2017 Yes it was never going to be that easy. I've tried a few different ways to get it to work. It is a required field in the database and I switched that off. I turned off recapcha and still no joy so like you said there is something else going on somewhere. Hopefully someone with more knowledge than me will have a solution for you. I removed $.validator.addMethod("phone", function(phone, element) { phone = phone.replace(/\s+/g, ""); return this.optional(element) || phone.match(/^[0-9-+()]+$/); }, $('#validate_phone').text()); $.extend(jQuery.validator.messages, { required: $('#validate_field_required').text() }); from the js/3.cubecart.validate.js file and it allowed registration without a phone number. Don't know if it has any other implications anywhere but it seems to work. Quote Link to comment Share on other sites More sharing options...
Christopher Short Posted August 17, 2017 Author Share Posted August 17, 2017 Mine still allows people not to enter it... Quote Link to comment Share on other sites More sharing options...
Will Shaman Posted August 17, 2017 Share Posted August 17, 2017 I removed $.validator.addMethod("phone", function(phone, element) { phone = phone.replace(/\s+/g, ""); return this.optional(element) || phone.match(/^[0-9-+()]+$/); }, $('#validate_phone').text()); $.extend(jQuery.validator.messages, { required: $('#validate_field_required').text() }); from the js/3.cubecart.validate.js file and it allowed registration without a phone number. That sounds great, ayz1, except I can't find js/3.cubecart.validate.js. I have a directory called js, but no file called 3.cubecart.validate.js. I might wonder if this depends on what skin I'm using, but directory js isn't within the skins directory. I'm using the slightly out of dat v.6.0.12 — would that make a difference to the directories used? Thanks for all your help! Will Mine still allows people not to enter it... Hi Christopher – would you mind letting me know what version CC and skin you're using, please? I'm running CC 6.0.12 plus Minimiser as a child of Foundation (it's heavily based on Foundation, apparently). Thanks for your input. Will Quote Link to comment Share on other sites More sharing options...
ayz1 Posted August 17, 2017 Share Posted August 17, 2017 The file is in the skins/foundation/js folder 1 Quote Link to comment Share on other sites More sharing options...
Will Shaman Posted August 17, 2017 Share Posted August 17, 2017 THANKS AYZ1! SILLY ME!! Quote Link to comment Share on other sites More sharing options...
Will Shaman Posted September 19, 2017 Share Posted September 19, 2017 On 17/08/2017 at 2:43 PM, Christopher Short said: Mine still allows people not to enter it... Hi Christopher, Wondering how you achieved this — phone number not being required? Is it to do with the skin you're using and, if so, could you please let me know what skin you have? Thanks in advance, Will Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.