Forums / Built-in Shipping and Payment Modules / Pre-Select A Payment Option at check-out?

Pre-Select A Payment Option at check-out?

Locked

Views: 7,735

Results 21 to 25 of 25
This thread is locked. New replies are disabled.
17 Oct 2006, 12:03 AM
#21
incredibody avatar

incredibody

New Zenner

Join Date:
Jun 2006
Posts:
78
Plugin Contributions:
0

Pre-Select A Payment Option at check-out?

I would like to know if this mod works with version 1.3.5 before I try installing it. It only listed 1.3.0.

17 Oct 2006, 1:06 AM
#22
seethrou avatar

seethrou

Totally Zenned

Join Date:
May 2004
Location:
Hong Kong
Posts:
1,156
Plugin Contributions:
0

Re: Pre-Select A Payment Option at check-out?

If for the Zen Cart Order Manager, there is a topic about it.
May be ask and discuss there. :smile:
Zen-Cart Order Manager

.

A New Starter again

6 Nov 2006, 10:52 PM
#23
kronok avatar

kronok

New Zenner

Join Date:
Jun 2004
Posts:
8
Plugin Contributions:
0

Re: Pre-Select A Payment Option at check-out?

I really think this should be built in by default. People always miss that "credit card" radio button when filling it out. There should be a "selected: True | False" thing in the Payments admin area.

21 Dec 2006, 6:05 AM
#24
spydazcomputers avatar

spydazcomputers

New Zenner

Join Date:
Oct 2006
Posts:
3
Plugin Contributions:
0

Re: Pre-Select A Payment Option at check-out?

There is a fairly simple solution to this problem
I edited the code in /includes/templates/template_default/templates/tpl_checkout_payment_default.php

the edit basically sets it so which ever payment method is first in your sort order is the selected option it requires adding a variable called $checked_set and setting the value to true before entering the FOR loop that prints the radio buttons/payment methods and then setting to false before the end of the for statement but after the printing of the radio buttons and then also changing the call to zen_draw_radio_field() to use that variable rather than the one it is looking up so for those of you who wanted to know the solution there it is... for those of you who just want it fixed here is the code and the replacement code replacements will be marked in red

ORIG FOR STATEMENT

<?php $radio_buttons = 0; for ($i=0, $n=sizeof($selection); $i<$n; $i++) { ?> <?php if (sizeof($selection) > 1) { ?> <?php echo zen_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $_SESSION['payment'] ? true : false), 'id="pmt-'.$selection[$i]['id'].'"'); ?> <?php } else { ?> <?php echo zen_draw_hidden_field('payment', $selection[$i]['id']); ?> <?php } ?>

<label for="pmt-<?php echo $selection[$i]['id']; ?>" class="radioButtonLabel"><?php echo $selection[$i]['module']; ?></label>

<?php if (MODULE_ORDER_TOTAL_COD_STATUS == 'true' and $selection[$i]['id'] == 'cod') { ?> <div class="alert"><?php echo TEXT_INFO_COD_FEES; ?></div> <?php } else { // echo 'WRONG ' . $selection[$i]['id']; ?> <?php } ?> <br class="clearBoth" /> <?php if (isset($selection[$i]['error'])) { ?> <div><?php echo $selection[$i]['error']; ?></div> <?php } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) { ?> <div class="ccinfo"> <?php for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) { ?> <label <?php echo (isset($selection[$i]['fields'][$j]['tag']) ? 'for="'.$selection[$i]['fields'][$j]['tag'] . '" ' : ''); ?>class="inputLabelPayment"><?php echo $selection[$i]['fields'][$j]['title']; ?></label><?php echo $selection[$i]['fields'][$j]['field']; ?> <br class="clearBoth" /> <?php } ?> </div> <br class="clearBoth" /> <?php } $radio_buttons++; ?> <br class="clearBoth" /> <?php } ?>

END ORIGIONAL FOR STATMENT

NEW FOR STATEMENT

<?php $radio_buttons = 0; $checked_set = true; for ($i=0, $n=sizeof($selection); $i<$n; $i++) { ?> <?php if (sizeof($selection) > 1) { ?> <?php echo '<p align="left">' . zen_draw_radio_field('payment', $selection[$i]['id'], $checked_set , 'id="pmt-'.$selection[$i]['id'].'"'); ?> <?php } else { ?> <?php echo zen_draw_hidden_field('payment', $selection[$i]['id']); ?> <?php } ?>

<label for="pmt-<?php echo $selection[$i]['id']; ?>" class="radioButtonLabel"><?php echo $selection[$i]['module']; ?></label> </p>

<?php if (MODULE_ORDER_TOTAL_COD_STATUS == 'true' and $selection[$i]['id'] == 'cod') { ?> <div class="alert"><?php echo TEXT_INFO_COD_FEES; ?></div> <?php } else { // echo 'WRONG ' . $selection[$i]['id']; ?> <?php } ?> <br class="clearBoth" /> <?php if (isset($selection[$i]['error'])) { ?> <div><?php echo $selection[$i]['error']; ?></div> <?php } elseif (isset($selection[$i]['fields']) && is_array($selection[$i]['fields'])) { ?> <div class="ccinfo"> <?php for ($j=0, $n2=sizeof($selection[$i]['fields']); $j<$n2; $j++) { ?><label <?php echo (isset($selection[$i]['fields'][$j]['tag']) ? 'for="'.$selection[$i]['fields'][$j]['tag'] . '" ' : ''); ?>class="inputLabelPayment"><?php echo $selection[$i]['fields'][$j]['title']; ?></label><?php echo $selection[$i]['fields'][$j]['field']; ?> <br class="clearBoth" /> <?php } ?> </div> <br class="clearBoth" /> <?php } $radio_buttons++; $checked_set = false; ?> <br class="clearBoth" /> <?php } ?>

END OF NEW FOR STATEMENT

Hope this Helps RYAN:cool:

1 Oct 2007, 1:04 PM
#25
peanut77 avatar

peanut77

Zen Follower

Join Date:
Feb 2005
Posts:
266
Plugin Contributions:
0

Re: Pre-Select A Payment Option at check-out?

Hi,
It looks like newer versions of Zen Cart have auto-selecting of appropriate payment radio-buttons as a built-in feature now.