Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Radio Buttons In Payment Module


garret

Recommended Posts

:-" hi

I'm seraching, searching ... but can't find similar situatnion

 

 

In my first/new payment module I have:

 

function confirmation(){

global $HTTP_POST_VARS, $order, $currencies;
$wynik .= 'please make extra choose:';
$wynik .= '<input type="radio" name="my_var" value="1" checked> text_1';
$wynik .= '<input type="radio" name="my_var" value="2"> text_2';

return array('title' => $wynik);
}

 

How to set/push this my_var value to checkout_process.php ??

I mean info with one was selected by end user ???

Could you please help me :'(

Link to comment
Share on other sites

qarret,

You should use the function available something like this....

<td class="main" align="right"><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?></td>

 

I hope this helps

Roman

dittone.com

Link to comment
Share on other sites

thank you Roman

 

I replace to osC radio:

 

function confirmation(){

global $HTTP_POST_VARS, $order, $currencies;
$wynik .= 'please make extra choose:';
$wynik .= tep_draw_radio_field('my_var', '1', 'checked') .'text_1';
$wynik .= tep_draw_radio_field('my_var', '2', '') .'text_2';

return array('title' => $wynik);
}

 

but it not solve the problem :( or I did something wrong ?

 

I mean my_var don't appear in next step of payment -> checkout_process.php as $my_var ?

I try hard but can't find where value of my_var should be POST to get it in checkout_process.php ?

Link to comment
Share on other sites

dear Roman

 

I know how to read from POST :)

 

problem is that I don't know how to put in POST my_var

staying in payment module function

 

function confirmation(){

}

:( :( :(

 

so after pressing Confirm Order -> read it

Link to comment
Share on other sites

please see this:

 

 

function confirmation() {

global $HTTP_POST_VARS, $order, $currencies;

$wynik .= tep_draw_radio_field('my_var', '1', 'checked') .'Standard 1 Year<br>';
$wynik .= tep_draw_radio_field('my_var', '2', '') .'Extended 2 Year';

return array('title' => $wynik);
}

function process_button() {
global $HTTP_POST_VARS, $order, $currencies;

if (isset($HTTP_POST_VARS['my_var'])) $my_var = $HTTP_POST_VARS['my_var'];
else $my_var='juuuuuhuuuu';

$process_button_string .= tep_draw_hidden_field('need_this', $my_var);

return $process_button_string;
}

 

In checkout_process.php after echo $need_this I see always juuuuuhuuuu

instead of 1 or 2 from my_var as it should be :(

so my_var is not in POST :(

How to make it will be ????

Link to comment
Share on other sites

qarret,

 

This code will post to the form...

 

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

 

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

 

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

 

 

This code when the confirm order button is clicked then post will be made and transfer will be

made to tep_href_link(FILENAME_CHECKOUT_PROCESS

 

I hope that helps

Roman

Link to comment
Share on other sites

thx :'(

 

I found this too ... try many different ways like:

<?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)) {



tep_draw_hidden_field('my_var', $my_var);



echo $payment_modules->process_button();
 }
 echo tep_image_submit('button_confirm_order.gif', IMAGE_BUTTON_CONFIRM_ORDER) . '</form>' . "\n";
?>

 

but all failed :( Really no idea what can I do to see my_var in checkout_process.php (in fact I need it in e-mail with confirmation)

 

:'(

Link to comment
Share on other sites

:-" hi

I'm seraching, searching ... but can't find similar situatnion

In my first/new payment module I have:

 

function confirmation(){

global $HTTP_POST_VARS, $order, $currencies;
$wynik .= 'please make extra choose:';
$wynik .= '<input type="radio" name="my_var" value="1" checked> text_1';
$wynik .= '<input type="radio" name="my_var" value="2"> text_2';

return array('title' => $wynik);
}

 

How to set/push this my_var value to checkout_process.php ??

I mean info with one was selected by end user ???

Could you please help me :'(

 

You need to create a session for this object in order for the information to get to your desired file. A session is kinda like having a global variable that every file can read. What I would probably do is in your store/includes/applications_top.php, go to the very end of the file, and then insert this code:

 

if (!tep_session_is_registered('my_var')){
		tep_session_register('my_var');
	}
	if(isset($HTTP_POST_VARS['my_var']) && tep_not_null($HTTP_POST_VARS['my_var'])){
		$my_var = tep_db_prepare_input($HTTP_POST_VARS['my_var']);
	}else if(!tep_not_null($my_var)){
		$my_var = 'text_1';
	}

 

When you want to call the value of this object later on, all that you have to is $my_var and it's value will be available to you.

Link to comment
Share on other sites

thx BeauCowan

 

I did as you said in applications_top.php

if (!tep_session_is_registered('my_var')){
		tep_session_register('my_var');
	}
	if(isset($HTTP_POST_VARS['my_var']) && tep_not_null($HTTP_POST_VARS['my_var'])){
		$my_var = tep_db_prepare_input($HTTP_POST_VARS['my_var']);
	}else if(!tep_not_null($my_var)){
		$my_var = 'default_text_information';
	}

 

but -> after choosing radio button and pressing "confirm order" -> value of $my_var stay always 'default_text_information'

it dosen't change to 1 or 2 as it should be <_<

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...