Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

beta release extra questions


nana

Recommended Posts

this is my file

<?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;
if ($display_account_answers == 1)$locID=$HTTP_GET_VARS['cID'];
$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
}


?>

Link to comment
Share on other sites

  • Replies 84
  • Created
  • Last Reply

Top Posters In This Topic

I've installed this and triple-checked over everything, and the answers aren't getting recorded into the database after I place an order. I'm using the files from 3 Nov and the install instructions from 15 Nov. Any help is appreciated.

Link to comment
Share on other sites

Hey Frank-

 

How feasible would it be to add a question on the checkout_confirmation page? I'm trying to set my store up to accept wholesale orders, and for those customers will (probably) be skipping the shipping and payment pages.

 

But, I would like wholesale customers to input a requested delivery date with their order (this might be nice for retail customers too, but not necessarily). Since checkout_confirmation.php is the only order page they see, how likely is it to be able to modify this page for this purpose?

 

Cheers

Stew

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

dez i am glad it is working

stew no i you can not add it to checkout_confirmation.php

but you can add it to checkout_success.php

 

And it gets written to the order details?

Do, or do not. There is no try.

 

Order Editor 5.0.6 "Ultra Violet" is now available!

For support or to post comments, suggestions, etc, please visit the Order Editor support thread.

Link to comment
Share on other sites

it gets written to its own table which can be called from any page at the moment in the admin section is available in the invoice order and packing slip

it is a very simple code that adds the fields and updates a table nothing really that special but functional and simple to understand

Link to comment
Share on other sites

  • 3 weeks later...

Hello,

 

I only want to add the 5 questions in the "checkout_success.php" page. Do I still have to modify all 15 files (per your instructions)? Can it work only modifying:

 

*checkout_success.php

*includes/database_tables.php

*includes/functions/html_output.php

*includes/languages/english.php

*admin/includes/filenames.php

*admin/includes/column_left.php.php

*admin/includes/database_tables.php

*admin/includes/languages/english.php

 

Thanks,

Jess.

 

P.S. I think this contribution is EXACTLY what I was looking for - thanks it seems great! :-)

Link to comment
Share on other sites

Hello,

 

Installed this contribution and have a couple of errors:

 

In Admin, when viewing orders, I see this error:

Warning: main(display_answer_box.php): failed to open stream: No such file or directory in /home/rmysite/public_html/catalog/admin/orders.php on line 420

Warning: main(display_answer_box.php): failed to open stream: No such file or directory in /home/mysite/public_html/osCommerce/catalog/admin/orders.php on line 420

Fatal error: main(): Failed opening required 'display_answer_box.php' (include_path='.:/usr/local/lib/php') in /home/mysite/public_html/catalog/admin/orders.php on line 420

 

Wha happen? :-)

Link to comment
Share on other sites

Hello,

 

I only want to add the 5 questions in the "checkout_success.php" page. Do I still have to modify all 15 files (per your instructions)? Can it work only modifying:

 

*checkout_success.php

*includes/database_tables.php

*includes/functions/html_output.php

*includes/languages/english.php

*admin/includes/filenames.php

*admin/includes/column_left.php.php

*admin/includes/database_tables.php

*admin/includes/languages/english.php

 

Thanks,

Jess.

 

P.S. I think this contribution is EXACTLY what I was looking for - thanks it seems great! :-)

 

I would like to know this too??

 

Thank you,

Michael

Edited by mrgtec

Michael

Link to comment
Share on other sites

Hi,

Installed this contribution and it works great!

 

I had a couple of ideas for it though and am not sure how to implement them.

 

1) Would it be possible to have java alerts tell you when a required field needs to be filled in?

 

2) Is there a way to make the text fields save what the visitor entered so if they do something like update their cart or something else and come back to the checkout_shipping.php page they dont have to fill the 5 extra questions out again? (I think the comments field does this but I am not sure)

 

 

Anyway, thanks again, this saved me days of guessing and fiddling around. It was also a great way to learn the ins and outs of osCommerce.

Link to comment
Share on other sites

How am I able to create more questions....I need a total of about 16.

 

 

I am also looking to do this but am not sure which files i need to duplicate the code which made the first 5 appear. Anybody know?

Link to comment
Share on other sites

Hi, Nana,

 

How would I put my questions in the left column of this script, or above the anwsers like this -

 

Did you find everything you wanted?
Yes
No

 

Not like this -

 

First Question
Yes
No

 

Thank you,

Michael

Michael

Link to comment
Share on other sites

Has anyone figured out how to save what the customer entered in the text boxes so that if I have my 5 extra questions showing in the checkout process and they decide to edit their order at the last confirmation screen they dont have to refill out all 5 when it shoots them back?

 

The "comments about your order" box does this already but I cant seem to apply it to this mod and get it to work.

 

 

Thanks for any help!

Link to comment
Share on other sites

Hello,

 

Installed this contribution and have a couple of errors:

 

In Admin, when viewing orders, I see this error:

Warning: main(display_answer_box.php): failed to open stream: No such file or directory in /home/rmysite/public_html/catalog/admin/orders.php on line 420

Warning: main(display_answer_box.php): failed to open stream: No such file or directory in /home/mysite/public_html/osCommerce/catalog/admin/orders.php on line 420

Fatal error: main(): Failed opening required 'display_answer_box.php' (include_path='.:/usr/local/lib/php') in /home/mysite/public_html/catalog/admin/orders.php on line 420

 

Wha happen? :-)

 

Jesse, did you get it to work? I have the same error message and cannot seem to get it to work, any luck?

 

I do not understand where "display_answer_box.php" comes from?!?

 

Thanks

 

S MCD

 

S McD

Edited by Flumpydog
Link to comment
Share on other sites

Thanks to user Boxtel I was able to figure out how to make the extra questions form fields remember what was entered into them for the duration of the customers stay on your site:

 

So for each of the five questions use the format below:

 

echo tep_draw_textarea_field('question_one_form','','size="25"');

 

 

And then add these into the top of the page where you are including extra_questions_show_box.php (I put mine into checkout_shipping.php because that is where I am asking my extra questions)

 

 

 

<?php if (!tep_session_is_registered('question_one_form')) tep_session_register('question_one_form');

if (isset($HTTP_POST_VARS['question_one_form'])) {

$question_one_form = tep_db_prepare_input($HTTP_POST_VARS['question_one_form']);

}

?>

Link to comment
Share on other sites

So for each of the five questions use the format below:

 

echo tep_draw_textarea_field('question_one_form','','size="25"');

 

Do you mean that we should use this format on these in extra_questions_show_box.php:

 

if (DISPLAY_FIRST_QUESTION_TYPE == 'drop_down')	echo tep_draw_pull_down_menu('question_one_form', $question_one);
	   if (DISPLAY_FIRST_QUESTION_TYPE == 'input_field')  echo tep_draw_input_field('question_one_form');
	   if (DISPLAY_FIRST_QUESTION_TYPE == 'radio_button') echo tep_draw_radio_menu('question_one_form', $question_one);
	   if (DISPLAY_FIRST_QUESTION_TYPE == 'check_box')	  echo tep_draw_checkbox_field('question_one_form', 'Yes');

Edited by kbking
Link to comment
Share on other sites

Strange, I played with it a bit in Admin, changed from drop_down to Checkbox, set to True and False at Display Questions and so forth. At first the First, Second, Fourth and Fifth Questions were visible and editable in Admin, but all of a sudden only First, Second and Third are visible and editable. I am using the script in checkout_shipping.php and on this page all five questions shows up.

 

Very odd. What could possibly cause this?

 

Otherwise there seems to be no problem, the answers show up on checkout_confirmation.php and in the order email as well.

Link to comment
Share on other sites

I added the code, but it's not working. If I go back to the first step of the checkout process it remembers the first selected question, but not the remaining four.

 

My code looks like this:

 

<tr>
				<td colspan="" class="main"> </td>
				<td class="main">
				<?php if (!tep_session_is_registered('question_one_form')) tep_session_register('question_one_form');
if (isset($HTTP_POST_VARS['question_one_form'])) {
$question_one_form = tep_db_prepare_input($HTTP_POST_VARS['question_one_form']);
}
?>

				<?php
 if (DISPLAY_FIRST_QUESTION == 'true') {
 $question_one = array();
if (DISPLAY_FIRST_QUESTION_TYPE == 'drop_down')   $question_one[] = array('id' => '-', 'text' =>FIRST_ANSWER_DEFAULT);
 $question_one_querry = tep_db_query("select sources_id, sources_name from " . TABLE_QUESTIONS . " where question_number =1 order by sources_name");
 while($question_one_values =  tep_db_fetch_array($question_one_querry)) {
 $question_one[] = array('id' =>  $question_one_values['sources_name'],
					   'text' => $question_one_values['sources_name']);
}
?>


				<?php					 
	   if (DISPLAY_FIRST_QUESTION_TYPE == 'drop_down')	echo tep_draw_pull_down_menu('question_one_form', $question_one);
	   if (DISPLAY_FIRST_QUESTION_TYPE == 'input_field')  echo tep_draw_input_field('question_one_form');
	   if (DISPLAY_FIRST_QUESTION_TYPE == 'radio_button') echo tep_draw_radio_menu('question_one_form', $question_one);
	   if (DISPLAY_FIRST_QUESTION_TYPE == 'check_box')	  echo tep_draw_checkbox_field('question_one_form', 'Yes');
?>
				  <?php if(FIRST_QUESTION_REQUIRED == 'true')echo '<span class="inputRequirement"> ' . ENTRY_SOURCE_OTHER_TEXT . '</span>'; ?>
				  <?php

}  
if (DISPLAY_SECOND_QUESTION == 'true') {
 $question_two = array();
 	   if (DISPLAY_SECOND_QUESTION_TYPE == 'drop_down') $question_two[] = array('id' => '-', 'text' =>SECOND_ANSWER_DEFAULT);
 $question_two_querry = tep_db_query("select sources_id, sources_name from " . TABLE_QUESTIONS . " where question_number =2 order by sources_name");
 while($question_two_values =  tep_db_fetch_array($question_two_querry)) {
 $question_two[] = array('id' =>  $question_two_values['sources_name'],
					   'text' => $question_two_values['sources_name']);
}
?>
				  <?php 
	   if (DISPLAY_SECOND_QUESTION_TYPE == 'drop_down')	echo tep_draw_pull_down_menu('question_two_form', $question_two);
	   if (DISPLAY_SECOND_QUESTION_TYPE == 'input_field')  echo tep_draw_input_field('question_two_form');
	   if (DISPLAY_SECOND_QUESTION_TYPE == 'radio_button') echo tep_draw_radio_menu('question_two_form', $question_two, $selected_attribute);
	   if (DISPLAY_SECOND_QUESTION_TYPE == 'check_box')	  echo tep_draw_checkbox_field('question_two_form', 'Yes');
?>
				  <?php if(SECOND_QUESTION_REQUIRED == 'true')echo '<span class="inputRequirement"> ' . ENTRY_SOURCE_OTHER_TEXT . '</span>'; ?>
				  <?php
}  if (DISPLAY_THIRD_QUESTION == 'true') {
 $question_three = array();
 if (DISPLAY_THIRD_QUESTION_TYPE == 'drop_down')  $question_three[] = array('id' => '-', 'text' =>THIRD_ANSWER_DEFAULT);
 $question_three_querry = tep_db_query("select sources_id, sources_name from " . TABLE_QUESTIONS . " where question_number =3 order by sources_name");
 while($question_three_values =  tep_db_fetch_array($question_three_querry)) {
 $question_three[] = array('id' =>  $question_three_values['sources_name'],
					   'text' => $question_three_values['sources_name']);
}
?>
				  <?php 
	   if (DISPLAY_THIRD_QUESTION_TYPE == 'drop_down')	echo tep_draw_pull_down_menu('question_three_form', $question_three);
	   if (DISPLAY_THIRD_QUESTION_TYPE == 'input_field')  echo tep_draw_input_field('question_three_form');
	   if (DISPLAY_THIRD_QUESTION_TYPE == 'radio_button') echo tep_draw_radio_menu('question_three_form', $question_three, $selected_attribute);
	   if (DISPLAY_THIRD_QUESTION_TYPE == 'check_box')	  echo tep_draw_checkbox_field('question_three_form', 'Yes');
?>
				  <?php if(THIRD_QUESTION_REQUIRED == 'true')echo '<span class="inputRequirement"> ' . ENTRY_SOURCE_OTHER_TEXT . '</span>'; ?></td>
				<td class="main"> </td>
			  </tr>
			  <tr>
				<td> </td>
				<td colspan=""><img src="images/pixel_trans.gif" width="100%" height="10" border="0" alt=""></td>
				<td> </td>
			  </tr>
			  <tr>
				<td class="main"><img src="images/default/2.gif" width="20" height="20"></td>
				<td colspan="" class="main"><?php echo FOURTH_TITLE; ?></td>
				<td class="main"> </td>
			  </tr>

<?php
}  if (DISPLAY_FOURTH_QUESTION == 'true') {
 $question_four = array();
 if (DISPLAY_FOURTH_QUESTION_TYPE == 'drop_down')   $question_four[] = array('id' => '----', 'text' =>FOURTH_ANSWER_DEFAULT);
 $question_four_querry = tep_db_query("select sources_id, sources_name from " . TABLE_QUESTIONS . " where question_number =4 order by sources_name");
 while($question_four_values =  tep_db_fetch_array($question_four_querry)) {
 $question_four[] = array('id' =>  $question_four_values['sources_name'],
					   'text' => $question_four_values['sources_name']);
}
?>
			  <tr>
				<td class="main"> </td>
				<td colspan="" class="main"><?php 
	   if (DISPLAY_FOURTH_QUESTION_TYPE == 'drop_down')	echo tep_draw_pull_down_menu('question_four_form', $question_four, '');
	   if (DISPLAY_FOURTH_QUESTION_TYPE == 'input_field')  echo tep_draw_input_field('question_four_form');
	   if (DISPLAY_FOURTH_QUESTION_TYPE == 'radio_button') echo tep_draw_radio_menu('question_four_form', $question_four, $selected_attribute);
	   if (DISPLAY_FOURTH_QUESTION_TYPE == 'check_box')	  echo tep_draw_checkbox_field('question_four_form', 'Yes');
?></td>
				<td class="main"><?php if(FOURTH_QUESTION_REQUIRED == 'true')echo '<span class="inputRequirement"> ' . ENTRY_SOURCE_OTHER_TEXT . '</span>'; ?></td>
			  </tr>
			  <tr>
				<td> </td>
				<td colspan=""><img src="images/pixel_trans.gif" width="100%" height="10" border="0" alt=""></td>
				<td> </td>
			  </tr>
			  <?php
}
if (DISPLAY_FIFTH_QUESTION == 'true') {
 $question_five = array();
 if (DISPLAY_FIFTH_QUESTION_TYPE == 'drop_down')   $question_five[] = array('id' => '----', 'text' =>FIFTH_ANSWER_DEFAULT);
 $question_five_querry = tep_db_query("select sources_id, sources_name from " . TABLE_QUESTIONS . " where question_number =5 order by sources_name");
 while($question_five_values =  tep_db_fetch_array($question_five_querry)) {
 $question_five[] = array('id' =>  $question_five_values['sources_name'],
					   'text' => $question_five_values['sources_name']);
}
?>
			  <tr>
				<td class="main"><img src="images/default/3.gif" width="20" height="20"></td>
				<td colspan="" class="main"><?php echo FIFTH_TITLE; ?></td>
				<td class="main"> </td>
			  </tr>
			  <tr>
				<td class="main"> </td>
			<td colspan="" class="main"><?php
	   if (DISPLAY_FIFTH_QUESTION_TYPE == 'drop_down')	echo tep_draw_pull_down_menu('question_five_form', $question_five);
	   if (DISPLAY_FIFTH_QUESTION_TYPE == 'input_field')  echo tep_draw_input_field('question_five_form','','size="60"');
	   if (DISPLAY_FIFTH_QUESTION_TYPE == 'radio_button') echo tep_draw_radio_menu('question_five_form', $question_five, $selected_attribute);
	   if (DISPLAY_FIFTH_QUESTION_TYPE == 'check_box')	  echo tep_draw_checkbox_field('question_five_form', 'Yes');
?>			</td>
			<td class="main"><?php if(FIFTH_QUESTION_REQUIRED == 'true')echo '<span class="inputRequirement"> ' . ENTRY_SOURCE_OTHER_TEXT . '</span>';?></td>
			</tr>
			  <tr>
				<td> </td>
				<td colspan=""><img src="images/pixel_trans.gif" width="100%" height="10" border="0" alt=""></td>
				<td> </td>
			  </tr>
		  </table></td>
		</tr>
	  </table></td>
  </tr>
  <tr>
	<td>
<?php
}  
?>

Link to comment
Share on other sites

that's a great contribution.

Thanks a lot.

 

By the way, if i only wanted create questions in create account page then save to DB, can i just change the :

catalog : create_account.php, database_tables.php, html_output.php, english.php

admin : filenames.php, column_left.php, database_tables.php, english.php

Link to comment
Share on other sites

  • 1 month later...

Hi Guys,

 

Did anyone ever manage to get the answers to the questions to show in admin/customers.php because for the life of me I can not get it to display.

 

This is the code I have from a previous post which says it should work (but it dont!)

 

		  <tr>
		<td class="main">
		   <?php if (ASK_QUESTION == 'true') {$display_answer = 1; require('display_answer_box.php'); } ?>
		 </td>
	  </tr>

 

If you did get this to work then please post the correct code here to save my sanity :blink:

 

Thanks

 

Mark

Lifes a bitch, then you marry one, then you die!

Link to comment
Share on other sites

Hi, I installed this contribution. I installed it appearing in the registration form and it works ok.

 

But I can't see the answer of the customer in customers.php in admin.

 

Just appears: "First question", not the answer... what's wrong???

 

I'm in the same way as Mark, my sanity is in danger too...

 

I'll appreciate your help... from Nana or anyone else...

 

Thanks and Regards,

 

James

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...