Zen Cart Logo
Forums / General Questions / Add a tex field to checkout_payment page

Add a tex field to checkout_payment page

Views: 806

Results 1 to 6 of 6
26 Feb 2014, 11:02 AM
#1
xav2 avatar

xav2

New Zenner

Join Date:
Jun 2013
Posts:
47
Plugin Contributions:
0

Add a tex field to checkout_payment page

i successfully added a text field to checkout_shipping page with the code below

checkout_shipping/header_php.php

if (isset($_SESSION['my_message'])) {
$my_message = $_SESSION['my_message'];
}

if (zen_not_null($_POST['my_message'])) {
$_SESSION['my_message'] = zen_db_prepare_input($_POST['my_message']);
}
$my_message = $_SESSION['my_message'];

tpl_checkout_shipping_default.php

<?php echo zen_draw_textarea_field('my_message', '45', '3'); ?>

but i want to add the text field to checkout_payment page,
anyone could help?

26 Feb 2014, 12:09 PM
#2
xav2 avatar

xav2

New Zenner

Join Date:
Jun 2013
Posts:
47
Plugin Contributions:
0

Re: Add a tex field to checkout_payment page

ok, i got the checkout_payment page work
but another question
what do i add a text field to checkout_confirmation page? it doesn't work

26 Feb 2014, 1:20 PM
#3
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Re: Add a tex field to checkout_payment page

Same process, add the text to the includes/modules/pages/checkout_confirmation/header_php.php and to the template page includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_confirmation_default.php

If you need to store it, make sure you add the new field to your database, then include the field in the order update SQL so it writes to the database when a customer completes their order.

27 Feb 2014, 7:34 AM
#4
xav2 avatar

xav2

New Zenner

Join Date:
Jun 2013
Posts:
47
Plugin Contributions:
0

Re: Add a tex field to checkout_payment page

yes, the text field contents stored to the database now

i want to do something more

from tpl_checkout_confirmation_default.php,
i change

<?php echo zen_draw_textarea_field('my_message', '45', '3'); ?>

to

<?php 
$my_code = something;
echo zen_draw_input_field('my_code', $my_code, $parameters = 'readonly', $type = 'text'); ?>

the input value of $my_code displays on the checkout confirmation page
but nothing written to database when an order completed

any ideas?

twitchtoo:

Same process, add the text to the includes/modules/pages/checkout_confirmation/header_php.php and to the template page includes/templates/YOUR_TEMPLATE/templates/tpl_checkout_confirmation_default.php

If you need to store it, make sure you add the new field to your database, then include the field in the order update SQL so it writes to the database when a customer completes their order.

27 Feb 2014, 7:45 AM
#5
xav2 avatar

xav2

New Zenner

Join Date:
Jun 2013
Posts:
47
Plugin Contributions:
0

Re: Add a tex field to checkout_payment page

the same code
on checkout_shipping page, it works

but on checkout_confirmation page, nothing written to database

27 Feb 2014, 7:56 AM
#6
xav2 avatar

xav2

New Zenner

Join Date:
Jun 2013
Posts:
47
Plugin Contributions:
0

Re: Add a tex field to checkout_payment page

the code below works on checkout_shipping page, i get the $my_code value written to database when an order completed
but when i tried it on checkout_confirmation page, nothing written to database

<?php 

//File checkout_shipping/header_php.php
if (isset($_SESSION['my_code'])) {
$my_code = $_SESSION['my_code'];
}
if (zen_not_null($_POST['my_code'])) {
$_SESSION['my_code'] = zen_db_prepare_input($_POST['my_code']);
}
$my_code = $_SESSION['my_code'];


//File tpl_checkout_shipping_default.php
$my_code = something;
echo zen_draw_input_field('my_code', $my_code, $parameters = 'readonly', $type = 'text');

?>