2012-08-30 64 views
2

這是我在onepagecheckout中的magento中的methods.phtml文件,我希望下拉(選擇選項)按鈕而不是單選按鈕.........以便我可以選擇付款方式來支付款項。在付款方式中選擇選項而不是magento中的radion按鈕

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

我無法看到你的消息.......... – Jyotiranjan

+1

你有沒有解決這個問題。我需要同樣的東西在我的magento。所以請幫助我,如果你有這個問題的解決方案 – Jalpesh

回答

-1

我用這一個讓我選擇列表,如果有幫助

<?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>';?> 
} 
+1

這不是問題的答案 – Jalpesh

+0

其他人可以提供食譜,配料必須自己選擇 – Saket

+0

是的我知道,但你的食譜是錯誤的,所以我不會選擇正確的成分。 – Jalpesh

2

可以在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> 
相關問題