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.
Views: 7,735
New Zenner
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.
Totally Zenned
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
New Zenner
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.
New Zenner
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:
Zen Follower
Hi,
It looks like newer versions of Zen Cart have auto-selecting of appropriate payment radio-buttons as a built-in feature now.
Tell staff why this post should be reviewed.