Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Must Agree To Terms


Guest

Recommended Posts

Can anyone tell me how to make a checkbox on the signup page of oscommerce that says i have read and agree to the terms and conditions...blah blah blah - that has to be checked in order to create the account. much like the one here for the board. is it hard?

 

I appreciate any help

Link to comment
Share on other sites

Contributions.

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

-------------------------------------------------------------------------------------------------------------------------

NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Thanks I have downloaded and am trying to incorporate. Thank you again for locating the file for me it saved me some time. I was looking but there alot of mods.

 

Thanks Again

Link to comment
Share on other sites

with regard to that contrib, i am using a 'recent' snapshot - 19/11/02, but am finding it vey hard to actually incorpate it into my shop.

 

I am no php programmer but am slowly learning, i can get the checkbox to show up but the checkout succeeds whether or not the box is checked.

 

I would appreciate any thoughts on this.

 

checkout_confirmation.php has been updated since that contribution came out and i can't for the life of me work out where to put a javascript function call for onsubmit="return checkCheckBox(this)", due to the fact that there is no '<form' opening tag visible. :roll:

 

any pointers would be greatly appreciated.

:wink:

cheers

barry

Link to comment
Share on other sites

i know what the problem is, i just can't figure out how to sort it.

 

the problem is the call to the javascript function, can't figure out where the call should go.

 

cheers

barry

Link to comment
Share on other sites

This can be because you didn't mod the code appropriately (if you did), the javascript for the check of the form has to be there.

 

Or,

 

It can happen because the code ASSUMES Javascript is enabled, which if you have it disabled, it will merrily go on its way.

 

The code should allow for non-Java users and browsers.

Steve

Link to comment
Share on other sites

This can be because you didn't mod the code appropriately (if you did), the javascript for the check of the form has to be there.  

 

Or,  

 

It can happen because the code ASSUMES Javascript is enabled, which if you have it disabled, it will merrily go on its way.  

 

The code should allow for non-Java users and browsers

 

with that in mind can you think of any way to do this function without using javascript?

 

Additionally where can i put the call to the javascript function in the coe quoted below. It is the new checkout process.

 

<?php

 if (is_array($payment_modules->modules)) {

   if ($confirmation = $payment_modules->confirmation()) {

?>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td class="main"><b><?php echo HEADING_PAYMENT_INFORMATION; ?></b></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">

         <tr class="infoBoxContents">

           <td><table border="0" cellspacing="0" cellpadding="2">

             <tr>

               <td class="main" colspan="4"><?php echo $confirmation['title']; ?></td>

             </tr>

<?php

     for ($i=0, $n=sizeof($confirmation['fields']); $i<$n; $i++) {

?>

             <tr>

               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

               <td class="main"><?php echo $confirmation['fields'][$i]['title']; ?></td>

               <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

               <td class="main"><?php echo $confirmation['fields'][$i]['field']; ?></td>

             </tr>

<?php

     }

?>

           </table></td>

         </tr>

       </table></td>

     </tr>

<?php

   }

?>

         <tr>

           <td align="right" class="main"><br>

 

 

 

 

<!--Start AGB Agreement form -->

 

<?php echo CONDITION_AGREEMENT; ?> <input type="checkbox" value="0" name="agree">

 

<!--Ende AGB Agreement form -->

 

 

 

 

 

 

<?php

 }

?>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td align="right" class="main">

<?php

 if (isset($$payment->form_action_url)) {

   $form_action_url = $$payment->form_action_url;

 } else {

   $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');

 }

 

 echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');

 

 if (is_array($payment_modules->modules)) {

   echo $payment_modules->process_button();

 }

 

 echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "n";

?>

 

once again any help is appreciated.

 

cheers

barry

Link to comment
Share on other sites

Assuming the check_form javascript is in there, it's simply:

 

tep_draw_form('checkout_confirmation', $form_action_url, 'post', 'onsubmit="return check_form();"');

 

This was re-typed so hopefully no typo.

 

 

As far as what to do with no Javascript, this takes a change on the NEXT page as without Java, you can't do anything with the current page. So, in checkout_process.php somewhere near the top:

 

if ($HTTP_POST_VARS['agree'] != 1) {

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode('SOME ERROR MESSAGE, or put in language file'), 'SSL'));

 

So, not too bad.

Steve

Link to comment
Share on other sites

i worked that one out, but cheers anyway for the post.

 

however......

 

I have gone with the non javascript way as it makes more sense to do it that way, but i'm still having problems.

 

 

i put in a checkbox field into the checkout_confirmation.php where the form is created. (see code below) and i added your other bit of code from your post to checkout_process.php. It is kicking out the error and not processing the order whether the checkbox is checked or not, so to some extent the code is working.

 

Basically it looks to me (the novice i am) as though the checkbox value is not being passed from checkout_confirmation.php to checkout_process.php, this is where i need help.

 

here is the code in checkout_confirmation.php

 

i have commented the added sections

 

<?php

 if (isset($$payment->form_action_url)) {

   $form_action_url = $$payment->form_action_url;

 } else {

   $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL');

 }

 echo tep_draw_checkbox_field('agree','1',false);



// terms and conditions check  

echo tep_draw_form('checkout_confirmation', $form_action_url, 'post');



// end



 if (is_array($payment_modules->modules)) {

   echo $payment_modules->process_button();

 }



 echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "n";

?>

 

and the code for checkout process

<?php

/*

 $Id: checkout_process.php,v 1.115 2002/11/17 14:09:24 project3000 Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2002 osCommerce



 Released under the GNU General Public License

*/



 include('includes/application_top.php');



// if the customer is not logged on, redirect them to the login page

 if (!tep_session_is_registered('customer_id')) {

   $navigation->set_snapshot(array('mode' => 'SSL', 'page' => FILENAME_CHECKOUT_PAYMENT));

   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 }

 

 if (!tep_session_is_registered('sendto')) {

   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

 }



 if ( (tep_not_null(MODULE_PAYMENT_INSTALLED)) && (!tep_session_is_registered('payment')) ) {

   tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'));

}



// avoid hack attempts during the checkout procedure by checking the internal cartID

 if (isset($cart->cartID) && tep_session_is_registered('cartID')) {

   if ($cart->cartID != $cartID) {

     tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));

   }

 }



 include(DIR_WS_LANGUAGES . $language . '/' . FILENAME_CHECKOUT_PROCESS);



// check for terms and conditions agreement  



 if ($HTTP_POST_VARS['agree'] != 1) { 

tep_redirect(tep_href_link(FILENAME_CHECKOUT_PAYMENT, 'error_message=' . urlencode('SOME ERROR MESSAGE, or put in language file'), 'SSL')); 

}



// end check

Link to comment
Share on other sites

sorry the first bit of code should read

 

<?php 

 if (isset($$payment->form_action_url)) { 

   $form_action_url = $$payment->form_action_url; 

 } else { 

   $form_action_url = tep_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL'); 

 } 



// terms and conditions check 

 echo tep_draw_checkbox_field('agree','1',false); 

// end checkbox



echo tep_draw_form('checkout_confirmation', $form_action_url, 'post'); 



// end 



 if (is_array($payment_modules->modules)) { 

   echo $payment_modules->process_button(); 

 } 



 echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "n"; 

?>

 

 

put the comment in the wrong place :oops:

 

cheers

barry

Link to comment
Share on other sites

cheers steve i noticed last night, sorted it and then went to bed!! :sleepy:

 

I was looking for something that wasn't as simple as that :stupid:

 

cheers guys

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...