Magento付款方式下拉菜单

时间:2018-02-18 19:21:50

标签: magento methods magento-1.9 payment checkout

我正在尝试将付款方式单选按钮更改为下拉菜单。

/app/design/frontend/default/modern/template/checkout/onepage/payment/methods.phtml

下面的方法在某种程度上有效,但是当Sagepay通过单选按钮处理订单时,在下拉菜单中它似乎无法成功处理。

请你看看,让我知道需要调用什么?非常感谢提前!

    <dl class="sp-methods" id="checkout-payment-method-load">

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

<?php
    $txtArr = array();
    $txt ="<select name='payment[method]' onchange='payment.switchMethod(this.value)'>";
    foreach ($methods as $_method):
        $_code = $_method->getCode();
?>
   <!-- <dt>-->
    <?php $txt = $txt."<option value='".$_code."' id='p_method_".$_code."'>".$this->htmlEscape($_method->getTitle())."</option>" ?>
    <?php if(!$oneMethod): ?>
        <!--<input id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" type="radio" name="payment[method]" title="<?php echo $this->htmlEscape($_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>-->
        <?php //echo $html; ?>
    <!--</dd>-->
        <?php $txtArr[] = $html;?>
    <?php endif; ?>

<?php endforeach; ?>
<?php $txt = $txt."</select>" ?>

<dt>
<?php echo $txt;?>
</dt>
<?php for($i=0;$i<count($txtArr);$i++){?>
<dt><?php echo $txtArr[$i];?></dt>
<?php } ?>



</dl>

<?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>

0 个答案:

没有答案