<?php
/**
 * OpenMage
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available at https://opensource.org/license/afl-3-0-php
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
 * @copyright   Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * One page checkout payment methods
 *
 * @var $this Mage_Checkout_Block_Onepage_Payment_Methods
 */

$methods = $this->getMethods();
$oneMethod = count($methods) <= 1;
?>

<?php if (empty($methods)): ?>
    <dt>
        <?php echo $this->__('No Payment Methods') ?>
    </dt>
<?php else: ?>
    <?php foreach ($methods as $_method): ?>
        <?php $_code = $_method->getCode(); ?>
        <dt id="dt_method_<?php echo $_code ?>">
            <?php if (!$oneMethod): ?>
                <input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->escapeHtml($_method->getTitle()) ?>" onclick="payment.switchMethod('<?php echo $_code ?>')"<?php if ($this->getSelectedMethodCode() == $_code): ?> checked="checked"<?php endif ?> class="radio" />
            <?php else: ?>
                <span class="no-display"><input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" checked="checked" class="radio" /></span>
                <?php $oneMethod = $_code; ?>
            <?php endif ?>
            <label for="p_method_<?php echo $_code ?>"><?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
        </dt>
        <?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
            <dd id="dd_method_<?php echo $_code ?>">
                <?php echo $html; ?>
            </dd>
        <?php endif ?>
    <?php endforeach ?>
<?php endif ?>
<?php echo $this->getChildChildHtml('additional'); ?>
<script type="text/javascript">
//<![CDATA[
<?php echo $this->getChildChildHtml('scripts'); ?>
payment.init();
<?php if (is_string($oneMethod)): ?>
payment.switchMethod('<?php echo $oneMethod ?>');
<?php endif ?>
//]]>
</script>
