babyewok Posted June 14, 2011 Share Posted June 14, 2011 My client sells fireworks and needs to make sure that the people buying from the site are over 18. I need to make the Date of Birth required on sign up and to check that the person is over 18, and if not, then to show this error message:We're sorry, but you need to be over 18 years of age in order to buy from our website.How can I go about doing this?I have the latest version of Prestashop Link to comment Share on other sites More sharing options...
babyewok Posted June 15, 2011 Author Share Posted June 15, 2011 No ideas about how I can do this? I really need to make the DOB required and automatically check they are over 18 Link to comment Share on other sites More sharing options...
ROB001 Posted October 27, 2011 Share Posted October 27, 2011 Hey babyewok, Did you ever find a solution to this? Link to comment Share on other sites More sharing options...
phrasespot Posted October 28, 2011 Share Posted October 28, 2011 Did you ever find a solution to this? You sell fireworks as well? Have a look at this module. Disclosure: module is built by me. Link to comment Share on other sites More sharing options...
ROB001 Posted October 28, 2011 Share Posted October 28, 2011 You sell fireworks as well? Have a look at this module. Disclosure: module is built by me. You are awesome! This is exactly what I need. I was able to get a minimum age by editing the Validate.php file but to make DOB mandatory was beyond me. I don't sell firework related products but tobacco related products. Cheers, Rob. Link to comment Share on other sites More sharing options...
babyewok Posted August 30, 2012 Author Share Posted August 30, 2012 All I could do was to check the birthday entered when registering to make sure they were over 18. If not, they get this message: You are too young to purchase from this site! Over 18s only. This was added below the other scripts at teh top of authentication.tpl in my theme <script type="text/javascript"> function checkAge() { /* the minumum age you want to allow in */ var min_age = 18; /* change "age_form" to whatever your form has for a name="..." */ var year = parseInt(document.forms["account-creation_form"]["years"].value); var month = parseInt(document.forms["account-creation_form"]["months"].value); var day = parseInt(document.forms["account-creation_form"]["days"].value); var theirDate = new Date((year + min_age), month, day); var today = new Date; if ((today.getTime() - theirDate.getTime()) < 0) { alert("You are too young to purchase from this site! Over 18s only"); return false; } else return true; } </script> Then right at the bottom, an onclick was added to the submit button: <input type="submit" name="submitAccount" id="submitAccount" value="{l s='Register'}" class="exclusive" onclick="return checkAge()" /> Hope that helps Link to comment Share on other sites More sharing options...
shaamt Posted September 26, 2013 Share Posted September 26, 2013 All I could do was to check the birthday entered when registering to make sure they were over 18. If not, they get this message: You are too young to purchase from this site! Over 18s only. This was added below the other scripts at teh top of authentication.tpl in my theme <script type="text/javascript"> function checkAge() { /* the minumum age you want to allow in */ var min_age = 18; /* change "age_form" to whatever your form has for a name="..." */ var year = parseInt(document.forms["account-creation_form"]["years"].value); var month = parseInt(document.forms["account-creation_form"]["months"].value); var day = parseInt(document.forms["account-creation_form"]["days"].value); var theirDate = new Date((year + min_age), month, day); var today = new Date; if ((today.getTime() - theirDate.getTime()) < 0) { alert("You are too young to purchase from this site! Over 18s only"); return false; } else return true; } </script>Then right at the bottom, an onclick was added to the submit button: <input type="submit" name="submitAccount" id="submitAccount" value="{l s='Register'}" class="exclusive" onclick="return checkAge()" />Hope that helps The code var theirDate = new Date((year + min_age), month, day); should be change to var theirDate = new Date((year + min_age), month-1, day); This is because the integer value representing the month, begin with 0 for January and not 1. Link to comment Share on other sites More sharing options...
learning1983 Posted November 11, 2014 Share Posted November 11, 2014 You sell fireworks as well? Have a look at this module. Disclosure: module is built by me. Hello, how can i download this module? Link to comment Share on other sites More sharing options...
vekia Posted November 12, 2014 Share Posted November 12, 2014 I will not be developing this module any further. Module codebase and rights has been transferred to another member of these forums, to a PrestaShop Gold Certified agency, who I have no doubt will continue to maintain the quality the users of the module have come to expect. All further queries about the module should be made to Marty. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now