[{if !$oHeidelpayViewConfig}]
    [{$smarty.block.parent}]
[{else}]

    [{* first loop is to render payment method selection *}]
    <div id="paymentMethods" class="dropdown">
        [{* only to track selection within DOM *}]
        <input type="hidden" id="sPaymentSelected" value="" />
        <div class="dropdown-toggle" data-toggle="dropdown" data-target="#">
            <a id="dLabelPaymentSelected" role="button" href="#">
                <span id="paymentSelected">[{oxmultilang ident="PAYMENT_METHOD"}]</span>
                <i class="glyphicon-chevron-down"></i>
            </a>
        </div>
        <ul class="dropdown-menu" role="menu" aria-labelledby="dLabelPaymentSelected">
            [{foreach key=sPaymentID from=$oView->getPaymentList() item=paymentmethod name=PaymentSelect}]
                [{block name="mb_select_payment_dropdown"}]
                    [{assign var=sPaymentName value=$paymentmethod->oxpayments__oxdesc->value}]
                    <li class="dropdown-option">
                        <a tabindex="-1" data-selection-id="[{$sPaymentID}]">[{$sPaymentName}]</a>
                    </li>
                    [{if $oView->getCheckedPaymentId() == $paymentmethod->oxpayments__oxid->value}]
                        [{oxscript add="$('#sPaymentSelected').val('$sPaymentID');"}]
                    [{/if}]
                [{/block}]
            [{/foreach}]
        </ul>
    </div>
    [{* second loop is to render payment method details *}]

    [{foreach key=sPaymentID from=$oView->getPaymentList() item=paymentmethod name=PaymentSelect}]
    [{* D3 Heidelpay ADD NEXT LINE *}]
        [{include file=$oView->d3GetOpenFormTemplateName($paymentmethod, 'mobile') payment=$paymentmethod}]
        [{block name="mb_select_payment"}]
            [{if $sPaymentID == "oxidcashondel"}]
                [{include file="page/checkout/inc/payment_oxidcashondel.tpl"}]
            [{elseif $sPaymentID == "oxidcreditcard"}]
                [{include file="page/checkout/inc/payment_oxidcreditcard.tpl"}]
            [{elseif $sPaymentID == "oxiddebitnote"}]
                [{include file="page/checkout/inc/payment_oxiddebitnote.tpl"}]
            [{else}]
                [{include file="page/checkout/inc/payment_other.tpl"}]
            [{/if}]
        [{/block}]

    [{* D3 Heidelpay ADD NEXT LINE *}]
        </form>

    [{/foreach}]
[{/if}]