选择付款方式中的选项,而不是magento中的单选按钮 [英] select option in payment method instead of radion button in magento

查看:108
本文介绍了选择付款方式中的选项,而不是magento中的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在magento的pagecheckout中的methods.phtml文件,我希望使用下拉菜单(选择选项)而不是单选按钮.........以便我可以选择付款方式来付款.

This is my methods.phtml file in onepagecheckout in magento,I want the dropdown(select option) button instead of radio button .........so that i could select the payment method to pay the payment.

<?php if (!$methods = $this->getMethods()) : ?>
  <p><?php echo $this->helper('checkout')->__('Sorry, no quotes are available for this order at this time.') ?></p>
   <?php else : ?>
     <dl class="sp-methods">
     <?php foreach ($this->getMethods() as $_method): $_code = $_method->getCode() ?>
     <dt>
         <?php if( sizeof($this->getMethods()) > 1 ): ?>

              <input  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 endif; ?>
              <label for="p_method_<?php echo $_code ?>"><?php echo $this->htmlEscape($_method->getTitle()) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?></label>
         </dt>
        <?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
          <dd>
            <?php echo $html; ?>
           </dd>
          <?php endif; ?>
       <?php endforeach; ?>
          </dl>
       <script type="text/javascript">
            //<![CDATA[
         <?php echo $this->getChildChildHtml('scripts'); ?>
                payment.init();
            //]]>
           </script>
      <?php endif; ?>

推荐答案

您可以按照 methods.phtml 文件中的代码下面的设置进行付款方式的选择选项下拉菜单.

You can do the select option dropdown for payment method as setup below code in methods.phtml file.

此外,您还必须在 opcheckout.js行715 中进行更改,以将"elements[i].checked"更改为"elements[i].value".

Also you have to changes in opcheckout.js line no 715 to change "elements[i].checked" to "elements[i].value".

<?php
    $methods = $this->getMethods();
    $oneMethod = count($methods) <= 1;
?>
<?php if (empty($methods)): ?>
    <dt>
        <?php echo $this->__('No Payment Methods') ?>
    </dt>
<?php else:
    ?>
    <dt>Select Payment Method:</dt>
    <select name="payment[method]" onchange="payment.switchMethod(this.value);">
    <?php
    foreach ($methods as $_method):
        $_code = $_method->getCode();
    ?>
        <option id="p_method_<?php echo $_code ?>" value="<?php echo $_code ?>" <?php if($this->getSelectedMethodCode()==$_code): ?> selected="selected"<?php endif; ?>>
            <?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?> <?php echo $this->getMethodLabelAfterHtml($_method) ?>
        </option>
<?php endforeach; ?>
    </select>
    <?php
    foreach ($methods as $_method):
        $_code = $_method->getCode();
    ?>
    <?php if ($html = $this->getPaymentMethodFormHtml($_method)): ?>
    <dd id="dd_method_<?php echo $_code ?>">
        <?php echo $html; ?>
    </dd>
    <?php endif;
    endforeach;
    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>

这篇关于选择付款方式中的选项,而不是magento中的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆