Guest Posted September 12, 2004 Share Posted September 12, 2004 Hi, i installed the contribution "dropdown for dob". as the title says it adds a drop down for the date of birth on the create_account.php page. This works no problem when creating an account, however, if someone signs up with a duplicate email address, it then produces this error... Date of Birth: Fatal error: [] operator not supported for strings in /home/buzzshop/public_html/create_account.php on line 378 The line it refers to is: <td class="main"> <?php for ($i=1; $i<32; $i++) { line378: $dob_day[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i)); } for ($i=1; $i<13; $i++) { $dob_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000))); } $today = getdate(); $first_year = $today['year'] - 77; $last_year = $today['year'] - 10; for ($i=$first_year; $i < $last_year; $i++) { $dob_year[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i)); } echo tep_draw_pull_down_menu('dob_day', $dob_day); echo tep_draw_pull_down_menu('dob_month', $dob_month); echo tep_draw_pull_down_menu('dob_year', $dob_year); echo tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''; ?> </td> that code replaced this original code in the create_account.php page, which was: <!-- <td class="main"><?php echo tep_draw_input_field('dob') . ' ' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td> --> this is a link to the contribution http://www.oscommerce.com/community/contributions,1547 Can anyone help me find out whats going wrong please? Quote Link to comment Share on other sites More sharing options...
jjanguda Posted September 13, 2004 Share Posted September 13, 2004 wow.. what a powerful and useful search function is it!!! I just installed the same contribution and have the same error.. But, in my case, my default country setting is United States and this is the only option for the country.. By miskate, I clicked that box and put it as "Select" As soon as I changed it, it showed me the same error message.. What's wrong with this? Any idea will be helpful. jjanguda Quote Link to comment Share on other sites More sharing options...
minuteago Posted September 16, 2004 Share Posted September 16, 2004 i do have the same problem.. still can't figure it out why... anyone? minuteago Quote Link to comment Share on other sites More sharing options...
Guest Posted January 4, 2005 Share Posted January 4, 2005 I've been having the same problems. My server doesn't print the error messages to the screen, so I never know what the problem was until now. After reading your error message, I found a solution to the problem: replace <?php for ($i=1; $i<32; $i++) { line378: $dob_day[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i)); } for ($i=1; $i<13; $i++) { $dob_month[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000))); } $today = getdate(); $first_year = $today['year'] - 77; $last_year = $today['year'] - 10; for ($i=$first_year; $i < $last_year; $i++) { $dob_year[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i)); } echo tep_draw_pull_down_menu('dob_day', $dob_day); echo tep_draw_pull_down_menu('dob_month', $dob_month); echo tep_draw_pull_down_menu('dob_year', $dob_year); echo tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''; ?> with <?php for ($i=1; $i<32; $i++) { $dob_day_arr[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i)); } for ($i=1; $i<13; $i++) { $dob_month_arr[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000))); } $today = getdate(); $first_year = $today['year'] - 77; $last_year = $today['year'] - 10; for ($i=$first_year; $i < $last_year; $i++) { $dob_year_arr[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i)); } echo tep_draw_pull_down_menu('dob_day', $dob_day_arr); echo tep_draw_pull_down_menu('dob_month', $dob_month_arr); echo tep_draw_pull_down_menu('dob_year', $dob_year_arr); echo tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''; ?> What I did was replace the arrays dob_day[], dob_month[] and dob_year[] with arrays by the same name with the suffix _arr. The reason for this, is that when the page calls for itself (as it does if the email address exists), it receives variables from your browser by the same names as the arrays. The error you got tells us that it can't turn a string variable into an array. It was trying to, because they have the same name. So giving the arrays a new, distinguishing name, solved the problem. You can replace your code with the one I put here. I'll ad a new version to the contribution for the next generations. -Ethan, doing my share. Quote Link to comment Share on other sites More sharing options...
Guest Posted May 13, 2005 Share Posted May 13, 2005 I've intergrated this contribution into my store and it works great. The only problem is that I also have Purchase without account and if a customer want to go down that route and not create an account. the drop down date of birth dosn't show up when the page requesting customer details comes up. Has anyone managed to get dropdown DOB working with PWA???? Any help would be much appreciated thanks. If you need me to post any code from PWA please let me know. Quote Link to comment Share on other sites More sharing options...
jderouen Posted July 30, 2005 Share Posted July 30, 2005 How would I change the year range on this? Currently, it says 1928 - 1987. While I don't have any customers born before 1928, I do have a few born after 1987. Thanks! Joe Quote Link to comment Share on other sites More sharing options...
altenter Posted August 28, 2005 Share Posted August 28, 2005 great and easily installed. thanks. how can i make th month appear as numbers, not letters? i.e: December becomes 12 etc... Quote Link to comment Share on other sites More sharing options...
altenter Posted August 28, 2005 Share Posted August 28, 2005 @ jderouen modify the following to suit your needs: $first_year = $today['year'] - 77; $last_year = $today['year'] - 17; the first line will take todays date and subtract 77 years from it. the second one will subtract 17 years from today. Quote Link to comment Share on other sites More sharing options...
Devz Posted October 19, 2005 Share Posted October 19, 2005 Very nice, compact addon module. Props to the creator, and subsequently revisors that fixed up the install instructions. Good work+ Quote Link to comment Share on other sites More sharing options...
Guest Posted November 24, 2005 Share Posted November 24, 2005 Neat Contrib - thanks for the quick fix to a standard problem!! regards, HL Quote Link to comment Share on other sites More sharing options...
chooch Posted January 6, 2006 Share Posted January 6, 2006 Neat Contrib - thanks for the quick fix to a standard problem!! regards, HL hi it may be a neat contribution BUT what happens if some wally selects 31 February ? it allows that date to go through... any way to block that? thanks Quote Upon receiving fixes and advice, too many people don't bother to post updates informing the forum of how it went. Until of course they need help again on other issues and they come running back! Why receive the information you require in good faith for free, only to then have the attitude to ignore the people who gave it to you? There's no harm in saying, 'Thanks, it worked'. On the contrary, it creates a better atmosphere. CHOOCH Link to comment Share on other sites More sharing options...
umc Posted June 7, 2006 Share Posted June 7, 2006 It is indeed a usefull contribution. I also made the modifications to the order_info.php file (because I have purchase without account and fast easy chechout, so when a guest wants to proceed to checkout he'll fill a form and have an account created) and to the account_edit.php file, where users will end up if they want to change their detailes. But here is not enough to just modify the file, because everytime you go to "change account information" the data shown will be the default one (which is not important when new accounts are about to be created), but if you already have a date set, it will not be shown. So, after you make the modifications from the contrib, at the second step where you are supposed to replace one line <td class="main"><?php echo tep_draw_input_field('dob') . ' ' . (tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''); ?></td> with block (I added line numbers to explain better the modifications): 1. <td class="main"> 2. <?php 3. for ($i=1; $i<32; $i++) { 4. $dob_day_arr[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i)); 5. } 6. for ($i=1; $i<13; $i++) { 7. $dob_month_arr[] = array('id' => sprintf('%02d', $i), 'text' => strftime('%B',mktime(0,0,0,$i,1,2000))); 8. } 9. $today = getdate(); 10. $first_year = $today['year'] - 77; 11. $last_year = $today['year'] - 17; 12. for ($i=$first_year; $i < $last_year; $i++) { 13. $dob_year_arr[] = array('id' => sprintf('%02d', $i), 'text' => sprintf('%02d', $i)); 14. } 15. echo tep_draw_pull_down_menu('dob_day', $dob_day_arr); 16. echo tep_draw_pull_down_menu('dob_month', $dob_month_arr); 17. echo tep_draw_pull_down_menu('dob_year', $dob_year_arr); 18. echo tep_not_null(ENTRY_DATE_OF_BIRTH_TEXT) ? '<span class="inputRequirement">' . ENTRY_DATE_OF_BIRTH_TEXT . '</span>': ''; 19. ?> 20. </td> Before line 15 add the following code: $s_dob = $account['customers_dob']; $dob_year = substr($s_dob, 0, 4); $dob_month = substr($s_dob, 5, 2); $dob_day = substr($s_dob, 8, 2); And lines 15, 16 and 17 become: echo tep_draw_pull_down_menu('dob_day', $dob_day_arr, $dob_day); echo tep_draw_pull_down_menu('dob_month', $dob_month_arr, $dob_month); echo tep_draw_pull_down_menu('dob_year', $dob_year_arr, $dob_year); ...that's it :). The values from the day of birth will be displayed in the combo-boxes. Hope it helped anyone. Best regards Quote Link to comment Share on other sites More sharing options...
Guest Posted June 7, 2006 Share Posted June 7, 2006 I do not see the need to collect data about our customers date of birth. If I was running an adult site, then maybe (but I would want a more secure method of doing it). With the increase in the numbers of cases of identity theft, I have tried to reduce what I collect to what is required for me to do business with them. Quote Link to comment Share on other sites More sharing options...
Dennis_gull Posted March 29, 2007 Share Posted March 29, 2007 when Refreshing the site the dob will get reseted, this is a quite big problem as the costumer probably wont see it and that will result in his dob being 01/01/1930. Does anyone know how to make it stay there as the rest of the info? Quote Link to comment Share on other sites More sharing options...
Guest Posted April 28, 2007 Share Posted April 28, 2007 hey I've just installed the contribution and wonder how can I get rid of this "(eg. 29/09/87)" in create account page? Quote Link to comment Share on other sites More sharing options...
jaswanttak Posted March 29, 2008 Share Posted March 29, 2008 I have a small issue while trying to select a day of the month above 12 it consistently says : Invalid Date of Birth (eg. 21/05/1970) no matter what i use above 12, anything 12 or below works fine? Any idea folks :) Thanks! Hello, I was also having the same issue. But its solved I have removed the condition of language checking in create account.php if($language == 'english') { $HTTP_POST_VARS['dob'] = $HTTP_POST_VARS['dob_month'].'/'.$HTTP_POST_VARS['dob_day'].'/'.$HTTP_POST_VARS['dob_year']; } $HTTP_POST_VARS['dob'] = $HTTP_POST_VARS['dob_day'].'/'.$HTTP_POST_VARS['dob_month'].'/'.$HTTP_POST_VARS['dob_year']; replaced this code with if(isset($HTTP_POST_VARS['dob_day']) && isset($HTTP_POST_VARS['dob_month']) && isset($HTTP_POST_VARS['dob_year'])) { $HTTP_POST_VARS['dob'] = $HTTP_POST_VARS['dob_month'].'/'.$HTTP_POST_VARS['dob_day'].'/'.$HTTP_POST_VARS['dob_year']; } this one. Quote Link to comment Share on other sites More sharing options...
Shadow-Lord Posted October 2, 2009 Share Posted October 2, 2009 How can I have a '-' in each dropdown of the dob, so that '-' will show as default. 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.