在付款方式,而不是在Magento radion按钮选择选项(select option in pa

2019-09-21 22:56发布

这是在Magento onepagecheckout我methods.phtml文件,我想下拉(选择选项)按钮,而不是单选按钮.........这样我可以选择的付款方式支付款项。

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

Answer 1:

你可以做的付款方式如下代码设置在methods.phtml文件中选择选项下拉菜单。

你也需要在opcheckout.js变化没有行715"elements[i].checked""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>


Answer 2:

我用这一个让我选择列表,如果有帮助

   <?php 
  $ptId1=mysql_query(" some query here")
 echo"<select name=ptId>";
    while($ptId=mysql_fetch_array($ptId1))
        {
            echo '<option value="'.$ptId['id'].'">'.$ptId['id'].'</option>';
        }
    echo '</select>';?>
}


文章来源: select option in payment method instead of radion button in magento