payam98 Posted May 18, 2017 Share Posted May 18, 2017 hi everyone , i want to remove password filed from the order form ! i can hide it but still the error will be there ! so client cannot submit the order. i want to know how can i remove completely ? or please tell me how can do something to generate automatic password ? i mean after client order the password will be generate automatically and send it to the client email. its very important for me 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted May 18, 2017 Share Posted May 18, 2017 generate the password and pass it to your template/URL using ActionHook:ClientAreaPageCart <?php add_hook("ClientAreaPageCart", 1, function($vars){ $generatedPassword = ''; return array("generatedpassword" => $generatedpassword); }); then edit /templates/orderforms/standards/checkout.tpl, replace: <input type="password" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}"> with: <input type="hidden" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}" value="{$generatedpassword}"> and: <input type="password" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}"> with: <input type="hidden" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}" value="{$generatedpassword}"> this way the password inputs will be hidden with a value, later you can send this password to client by email 1 Quote Link to comment Share on other sites More sharing options...
payam98 Posted May 18, 2017 Author Share Posted May 18, 2017 first of all thanks for your answer dear. just one thing i didn't understand the first part because i am too beginner. can u explain me little more what is the ActionHook:ClientAreaPageCart and where should i put the php code ? 0 Quote Link to comment Share on other sites More sharing options...
payam98 Posted May 18, 2017 Author Share Posted May 18, 2017 generate the password and pass it to your template/URL using ActionHook:ClientAreaPageCart <?php add_hook("ClientAreaPageCart", 1, function($vars){ $generatedPassword = ''; return array("generatedpassword" => $generatedpassword); }); then edit /templates/orderforms/standards/checkout.tpl, replace: <input type="password" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}"> with: <input type="hidden" name="password" id="inputNewPassword1" class="field" placeholder="{$LANG.clientareapassword}" value="{$generatedpassword}"> and: <input type="password" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}"> with: <input type="hidden" name="password2" id="inputNewPassword2" class="field" placeholder="{$LANG.clientareaconfirmpassword}" value="{$generatedpassword}"> this way the password inputs will be hidden with a value, later you can send this password to client by email can u explain me little more what is the ActionHook:ClientAreaPageCart and where should i put the php code ? 1 Quote Link to comment Share on other sites More sharing options...
sentq Posted May 19, 2017 Share Posted May 19, 2017 create new php file inside /includes/hooks/ directory (eg: generateRandomPassword.php) and put the following code inside: <?php add_hook("ClientAreaPageCart", 1, function($vars){ $passwordLength = 10; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $generatedPassword = ''; for ($i = 0; $i < $passwordLength; $i++) { $generatedPassword .= $characters[rand(0, $charactersLength - 1)]; } return array("generatedpassword" => $generatedpassword); }); 0 Quote Link to comment Share on other sites More sharing options...
payam98 Posted May 19, 2017 Author Share Posted May 19, 2017 create new php file inside /includes/hooks/ directory (eg: generateRandomPassword.php) and put the following code inside: <?php add_hook("ClientAreaPageCart", 1, function($vars){ $passwordLength = 10; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $generatedPassword = ''; for ($i = 0; $i < $passwordLength; $i++) { $generatedPassword .= $characters[rand(0, $charactersLength - 1)]; } return array("generatedpassword" => $generatedpassword); }); i did everything u said but still the error comes: You did not enter a password! what should i do? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 19, 2017 Share Posted May 19, 2017 try this instead.... <?php add_hook("ClientAreaPageCart", 1, function($vars){ $passwordLength = 10; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $generatedPassword = ''; for ($i = 0; $i < $passwordLength; $i++) { $generatedPassword .= $characters[mt_rand(0, $charactersLength - 1)]; } return array("generatedpassword" => $generatedPassword); }); 0 Quote Link to comment Share on other sites More sharing options...
payam98 Posted May 19, 2017 Author Share Posted May 19, 2017 try this instead.... <?php add_hook("ClientAreaPageCart", 1, function($vars){ $passwordLength = 10; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $generatedPassword = ''; for ($i = 0; $i < $passwordLength; $i++) { $generatedPassword .= $characters[mt_rand(0, $charactersLength - 1)]; } return array("generatedpassword" => $generatedPassword); }); its not work again! (You did not enter a password) its my website: http://vezeh.com/aa/whmcs/cart.php what should i do ?? my version is 6.3.1 0 Quote Link to comment Share on other sites More sharing options...
sentq Posted May 19, 2017 Share Posted May 19, 2017 try this instead! <?php add_hook("ClientAreaPage", 1, function($vars){ if ($vars['filename']!="cart"){ return; } $passwordLength = 10; $characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $charactersLength = strlen($characters); $generatedPassword = ''; for ($i = 0; $i < $passwordLength; $i++) { $generatedPassword .= $characters[mt_rand(0, $charactersLength - 1)]; } return array("generatedpassword" => $generatedPassword); }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 20, 2017 Share Posted May 20, 2017 what should i do ?? my version is 6.3.1 it might have been useful if you had mentioned that at the start. 0 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.