Forums / Bug Reports / [Done v2.0] Missing pmt id when only one payment method

[Done v2.0] Missing pmt id when only one payment method

Locked

Views: 2,112

Results 1 to 1 of 1
This thread is locked. New replies are disabled.
10 Nov 2009, 5:54 PM
#1
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Location:
Gijón, Asturias, Spain
Posts:
2,875
Plugin Contributions:
7

[Done v2.0] Missing pmt id when only one payment method

Hi,
(for 1.38a).
I filter the payment methods so only COD is available when COD is selected as a shipping option.
In

catalog\includes\templates\CUSTOM\templates\tpl_checkout_payment_default.php

I get a validation error when only one payment option is available:

Info: reference to non-existent ID "pmt-cod"

This is the browser html for one payment method (with the id missing):

<input type="hidden" name="payment" value="cod" /><label for="pmt-cod" class="PaymentTypeRadio">

This is the browser html (with the id in place) when there is more than one payment method (illustrated here with another method as COD is not available if not selected as a shipping method):

<input type="radio" name="payment" value="ceca" id="pmt-ceca" /><label for="pmt-ceca" class="PaymentTypeRadio">

This is the code:

<?php echo zen_draw_radio_field('payment', $selection[$i]['id'], ($selection[$i]['id'] == $_SESSION['payment'] ? true : false), 'id="pmt-'.$selection[$i]['id'].'"'); ?>
<?php   } ?>
<?php
    } else {
    	
?>
<?php echo zen_draw_hidden_field('payment', $selection[$i]['id']); ?>
<?php
    }
?>

When there is more than one payment method the id parameter is passed ok as the fourth value of function zen_draw_radio_field.
When there is only one payment method the id parameter is not passed as the (omitted) third value of function zen_draw_hidden_field.

So I think the last line should be

<?php echo zen_draw_hidden_field('payment', $selection[$i]['id'], 'id="pmt-'.$selection[$i]['id'].'"'); ?>

which validates,

regards
Steve

Steve
github.com/torvista: BackupMySQL, Structured Data, Multiple Copy-Move-Delete, Google reCaptcha, Image Checker, Spanish Language Pack and more...