nana Posted October 21, 2005 Posted October 21, 2005 this contribution lets you ask up to 5 questions either when customer is creating an account or checking out or after the purchase is made. you can choose from input field drop_down ckbox or radio botton all adjustments are made in the admin section please test and report the bugs here i have to start this tread so i can put the info in the contribution section i will add the contribution soon Quote
nana Posted October 21, 2005 Author Posted October 21, 2005 http://www.oscommerce.com/community/contributions,3685 Quote
nana Posted October 21, 2005 Author Posted October 21, 2005 i added a demo here admin has no password http://www.seelily.com/questions/admin/ i will have to remove it if it gets abused so be nice Quote
shaytaan Posted October 22, 2005 Posted October 22, 2005 i added a demo here admin has no password http://www.seelily.com/questions/admin/i will have to remove it if it gets abused so be nice  Fantastic contribution... :thumbsup: Quote ?,???`???,?? God must love stupid people, he made so many ??,???`???,?
nana Posted October 24, 2005 Author Posted October 24, 2005 it seems that i have made a mistake please run this in your sql file if you are having a miissing field error drop table if exists questions; CREATE TABLE questions ( source_id int NOT NULL auto_increment, sources_name varchar(64) NOT NULL, question_number int(4) NOT NULL, PRIMARY KEY (source_id), KEY IDX_SOURCES_NAME (sources_name) ); INSERT INTO questions VALUES (1, 'Google',1); INSERT INTO questions VALUES (2, 'Yahoo!',1); INSERT INTO questions VALUES (3, 'AOL',1); INSERT INTO questions VALUES (4, 'MSN',1); INSERT INTO questions VALUES (5, 'osCommerce',1); Quote
nana Posted October 25, 2005 Author Posted October 25, 2005 (edited) there was some bugs i just uploaded a new version very easy to upgrade Edited October 25, 2005 by nana Quote
Guest Posted October 26, 2005 Posted October 26, 2005 Frank, So far, this is working on my dev site with a few small issues. The required asterisks appear even when I have the required turned off for a question. Either way, they don't seem to pop an error for required when they're not filled out. Also, the answers don't appear in checkout_confirmation for me. Request: How do I get the answers to appear in the e-mails and a customer's order history? Quote
cczernia Posted November 4, 2005 Posted November 4, 2005 I'm a little confused on installation. Under part A on new files to upload you have this listed:  * includes/languages/english/extra_questions.php  However, I can't find and extra_questions.php under includes/languages/englishenglish. I found the one for admin. Are they the same file?  I also noticed a file includes/languages/questions_english.php but it doesn't have any instruction on what to do with it.  I was wondering if anyone has some clarification on installation of the contrib.  Thanks in advance. Quote Shade and Sweet Water Chris Czerniak
cczernia Posted November 7, 2005 Posted November 7, 2005 Ok, I have it installed and almost working. I just can't get it to output to order.php. I check and it is updating the database with my new questions. In order.php it shows "First Question" where I want but never outputs a value. Â Any ideas? Quote Shade and Sweet Water Chris Czerniak
nana Posted November 8, 2005 Author Posted November 8, 2005 dan i have sent you a modified version of extra_questions_show_box.php and extra_questions_upload_result_box.php that i think resolved the red * issue but you can use the one in the latest version. just make a copy of the ones you have incase chris use this for admin/display_answer_box.php <?php $extra_questions_query = tep_db_query("select first_answer,second_answer,third_answer, fourth_answer,fifth_answer from " . TABLE_ANSWERS . " where location_id = '" . (int)$oID . "'and location='" .QUESTION_LOCATION . "'" ); $extra_questions = tep_db_fetch_array($extra_questions_query); if (DISPLAY_FIRST_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FIRST_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['first_answer']; ?></td> </tr> <?php } if (DISPLAY_SECOND_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo SECOND_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['second_answer']; ?></td> </tr> <?php } if (DISPLAY_THIRD_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo THIRD_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['third_answer']; ?></td> </tr> <?php } if (DISPLAY_FOURTH_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FOURTH_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['fourth_answer']; ?></td> </tr> <?php } if (DISPLAY_FIFTH_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FIFTH_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['fifth_answer']; ?></td> </tr> <?php } ?> Quote
nana Posted November 8, 2005 Author Posted November 8, 2005 also you have to replace display_answer_after_order.php in the catalog folder to this i can not get the logic for checkout_success question yet but i will post as soon as i have a solution for that <?php if ($display_answer== 1) { $first_answer=$HTTP_SESSION_VARS['first_answer']; $second_answer=$HTTP_SESSION_VARS['second_answer']; $third_answer=$HTTP_SESSION_VARS['third_answer']; $fourth_answer=$HTTP_SESSION_VARS['fourth_answer']; $fifth_answer=$HTTP_SESSION_VARS['fifth_answer']; if (QUESTION_LOCATION == 'account'){ $locID=$customers_id; $extra_questions_query = tep_db_query("select first_answer,second_answer,third_answer, fourth_answer,fifth_answer from " . TABLE_ANSWERS . " where location_id = '" . (int)$locID . "'and location='" .QUESTION_LOCATION . "'" ); $extra_questions = tep_db_fetch_array($extra_questions_query); $first_answer=$extra_questions['first_answer']; $second_answer=$extra_questions['second_answer']; $third_answer=$extra_questions['third_answer']; $fourth_answer=$extra_questions['fourth_answer']; $fifth_answer=$extra_questions['fifth_answer']; } if (QUESTION_LOCATION == 'orders'){ $first_answer=$HTTP_SESSION_VARS['first_answer']; $second_answer=$HTTP_SESSION_VARS['second_answer']; $third_answer=$HTTP_SESSION_VARS['third_answer']; $fourth_answer=$HTTP_SESSION_VARS['fourth_answer']; $fifth_answer=$HTTP_SESSION_VARS['fifth_answer']; }} ?> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php if (DISPLAY_FIRST_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FIRST_TITLE; ?></b></td> <td class="main"><?php echo $first_answer; ?></td> </tr> <?php } if (DISPLAY_SECOND_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo SECOND_TITLE; ?></b></td> <td class="main"><?php echo $second_answer; ?></td> </tr> <?php } if (DISPLAY_THIRD_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo THIRD_TITLE; ?></b></td> <td class="main"><?php echo $third_answer; ?></td> </tr> <?php } if (DISPLAY_FOURTH_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FOURTH_TITLE; ?></b></td> <td class="main"><?php echo $fourth_answer; ?></td> </tr> <?php } if (DISPLAY_FIFTH_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FIFTH_TITLE; ?></b></td> <td class="main"><?php echo $fifth_answer; ?></td> </tr> <?php } ?> </table></td></tr></table></td></tr> Quote
Guest Posted November 8, 2005 Posted November 8, 2005 (edited) Hi, Frank! Got this just about set now and I'm really tickled with it! You've done a great job on this and saved me weeks of random mucking with code. Thanks again! It's running smoothly on my dev store now with my slashed up checkout. Thanks for guidance on that, too! I was considering making it a Contrib, but it looks like you might be making FEC do these things already. Anyway, here's the dev store if you want to see your work as I've set it up. It will be up there for a couple of weeks anyhow. The only change I want to make is to make the text box larger for the customer to input their gift message. I think it's set in the stylesheet to that size, but if you have any advice or thoughts, I'd sure appreciate it. Â Oh, yeah. The links in the javascript slideshow are hard coded and will jump to the live store, so don't use them. Also, the only product currently in stock on the dev store is the special (white climbing rose on the right). Edited November 8, 2005 by brushwood Quote
nana Posted November 8, 2005 Author Posted November 8, 2005 go ahead by all means if you want to make any contribution and code enhancment that you want you are probably more familiar with it than and i want to keep fec as simple as possible you see that even as it is now it is a handfull i am at work so i will ck your store as soon as i get home Quote
cczernia Posted November 9, 2005 Posted November 9, 2005 (edited) chris use this for admin/display_answer_box.php  I replaced the code and it is doing the same thing. This is what my output screen looks like:   Where "extra_questions" appears is boxed in red. So, the title is appearing. And I checked the questions and answers tables and they are collecting data. Edited November 9, 2005 by cczernia Quote Shade and Sweet Water Chris Czerniak
mwiznitzer Posted November 9, 2005 Posted November 9, 2005 (edited) I love this contribution. It's easy to install, and work with, good job :) Â I noticed that the required question messages appear on the top of the screen in a red bar instead of the pop-up menu like the rest of the required fields. A work-around is just simply makign it a drop down so the required portion isn't even necessary. Â My main issue is that I get this error whenever I try to view/delete a customer in the OsCommerce control panel. Â Warning: reset(): Passed variable is not an array or object in /admin/includes/classes/object_info.php on line 17 Â Warning: Variable passed to each() is not an array or object in /admin/includes/classes/object_info.php on line 18 Â Anyone encountered this / found a fix? Edited November 9, 2005 by mwiznitzer Quote
nana Posted November 10, 2005 Author Posted November 10, 2005 mwiznitzer i have seen this problem with a lot of contributions and i think it has something to do with address book enteries not matching up with customers i do not remmember the solution but i am sure if you check for the mismatch between the two tables or do a search in the forum you will find the answer    Chris this is my display_answer_box.php right of the demo site if it does not work please check the following the location field is correct it checks only for matching location i mean that if the location that the data is collected must matches the location when data is displayed if you change from account to order after the questions are answered it will not show in the admin section i would be glad to look at your site if you want to give me access to see if i can find the problem  <?php $extra_questions_query = tep_db_query("select first_answer,second_answer,third_answer, fourth_answer,fifth_answer from " . TABLE_ANSWERS . " where location_id = '" . (int)$oID . "'and location='" .QUESTION_LOCATION . "'" ); $extra_questions = tep_db_fetch_array($extra_questions_query); if (DISPLAY_FIRST_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FIRST_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['first_answer']; ?></td> </tr> <?php } if (DISPLAY_SECOND_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo SECOND_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['second_answer']; ?></td> </tr> <?php } if (DISPLAY_THIRD_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo THIRD_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['third_answer']; ?></td> </tr> <?php } if (DISPLAY_FOURTH_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FOURTH_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['fourth_answer']; ?></td> </tr> <?php } if (DISPLAY_FIFTH_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FIFTH_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['fifth_answer']; ?></td> </tr> <?php } ?> Quote
cczernia Posted November 10, 2005 Posted November 10, 2005 (edited) Chris this is my display_answer_box.php right of the demo siteif you change from account to order after the questions are answered it will not show in the admin section  Actually I did change from account to after_order and then back to account. For the one entry I had on after_order I did see the answer but after switching back to account I havn't seen anything. Edited November 10, 2005 by cczernia Quote Shade and Sweet Water Chris Czerniak
cczernia Posted November 14, 2005 Posted November 14, 2005 Ok, I ran into a new problem. Â Now, for some reason that database is not recording "location_id" correctly. Instead it is just recording a "0." The entry with the first 0 for location_id is getting displayed in every admin order. Quote Shade and Sweet Water Chris Czerniak
mwiznitzer Posted November 15, 2005 Posted November 15, 2005 Aye, thanks Frank. I had noticed an unsynced id scheme but I wasn't sure if that was it. I just re-installed, uploaded my modified files and its worked beautifully. Simple, thanks. Â Another question, how feasible is it to add more than 5 questions? Quote
Guest Posted November 15, 2005 Posted November 15, 2005 Aye, thanks Frank. I had noticed an unsynced id scheme but I wasn't sure if that was it. I just re-installed, uploaded my modified files and its worked beautifully. Simple, thanks. Another question, how feasible is it to add more than 5 questions? Careful, Mitch. I'm sure Frank can do this but you risk a lot by asking too many questions during checkout. You've gotten them this far in the process (you're now down to a few percent of all of your visitors to the site). Every step you add or information bit you ask will lose you more customers. Cart abandonment studies prove this fact. I love this Contrib. I'm just careful not to abuse it. In fact I have taken important steps to shorten my checkout to compensate for the extra questions. I'm not saying don't do it. Just be careful. Quote
e_piz Posted November 16, 2005 Posted November 16, 2005 hello, i'm a newbie here... anyway thx for the contribution, its fantastic... Â by the way, ihave a question regarding it..i added an extra question at the create new acc. page for members...which is succesfull..thx again for the contribution!! Â my question is, how do i retrieve the values/answers entered by the customers at the admin page... eg:catalog/admin/customers.php what code should i put so that it can retrieve the values which is submitted by the customers? Â a help on this would be very greatfull!! Quote
cczernia Posted November 16, 2005 Posted November 16, 2005 my question is, how do i retrieve the values/answers entered by the customers at the admin page... eg:catalog/admin/customers.php what code should i put so that it can retrieve the values which is submitted by the customers? Â a help on this would be very greatfull!! Â You can pretty much stick this line: Â <?php if (ASK_QUESTION == 'true') require('display_answer_box.php'); ?> Â in admin to display the answers. It was made for orders, invoice and packing slip but it might work for customers. I imagine this would be useful if you are asking questions in create account. Quote Shade and Sweet Water Chris Czerniak
nana Posted November 16, 2005 Author Posted November 16, 2005 (edited) i wanted to thank cczernia for writing and posting the documentation also it seems that i forgotten two things these changes should resolve all outstanding issues 1-in checkout_confirmation.php i have not included the red line   //extra questions start if (ASK_QUESTION == 'true') { $display_answer = 1;  require('display_answer_after_order.php'); } //extra questions end    2- please name this file display_answer_box.php and place it in your admin folder and place the line that cczernia has mentioned in the post just before this <?php if (QUESTION_LOCATION == 'orders')$locID=(int)$oID; if (QUESTION_LOCATION == 'account'){ $customer_id_query = tep_db_query("select orders_id,customers_id from " . TABLE_ORDERS . " where orders_id = '" . (int)$oID . "'"); $customer_id = tep_db_fetch_array($customer_id_query); $locID=$customer_id['customers_id']; } if (QUESTION_LOCATION == 'after_purchase')$locID=(int)$oID; $extra_questions_query = tep_db_query("select first_answer,second_answer,third_answer, fourth_answer,fifth_answer from " . TABLE_ANSWERS . " where location_id = '" . $locID . "'and location='" .QUESTION_LOCATION . "'" ); $extra_questions = tep_db_fetch_array($extra_questions_query); if (DISPLAY_FIRST_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FIRST_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['first_answer']; ?></td> </tr> <?php } if (DISPLAY_SECOND_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo SECOND_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['second_answer']; ?></td> </tr> <?php } if (DISPLAY_THIRD_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo THIRD_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['third_answer']; ?></td> </tr> <?php } if (DISPLAY_FOURTH_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FOURTH_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['fourth_answer']; ?></td> </tr> <?php } if (DISPLAY_FIFTH_QUESTION == 'true') { ?> <tr> <td class="main"><b><?php echo FIFTH_TITLE; ?></b></td> <td class="main"><?php echo $extra_questions['fifth_answer']; ?></td> </tr> <?php } ?> Edited November 16, 2005 by nana Quote
nana Posted November 17, 2005 Author Posted November 17, 2005 mitch to add more fields you have to go in each and every file and make the changes necessary Quote
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.
Note: Your post will require moderator approval before it will be visible.