            <div id="summary-details">
                <div class="section-title">
                    <h3><i class="fas fa-shopping-cart"></i> <?php $this->_('Summary.index.heading_summary');?></h3>
                    <p><?php $this->_('Summary.index.summary_note');?></p>
                </div>

                <div class="card card-order">
                    <div class="card-body">
                        <table class="table table-curved">
                            <thead>
                                <tr>
                                    <th><?php $this->_('Summary.index.table_description');?></th>
                                    <th></th>
                                    <th><?php $this->_('Summary.index.table_price');?></th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                foreach ((isset($summary['cart']['display_items']) ? $summary['cart']['display_items'] : []) as $item) {
                                ?>
                                    <tr>
                                        <td>
                                            <?php
                                            switch ((isset($item['type']) ? $item['type'] : null)) {
                                                case 'addon':
                                                case 'config_fee':
                                                    echo (isset($item['description']) ? $this->Html->safe($item['description']) : null);
                                                    break;
                                                default:
                                                    ?>
                                                    <strong><?php echo (isset($item['description']) ? $this->Html->safe($item['description']) : null);?></strong>
                                                    <?php
                                            }
                                            ?>
                                        </td>
                                        <td>
                                            <?php $this->_('Cart.index.quantity', false, $this->CurrencyFormat->truncateDecimal((isset($item['qty']) ? $item['qty'] : 1), 0));?>
                                        </td>
                                        <td class="price-col float-right">
                                            <strong class="currency_value"><?php echo (isset($item['price']) ? $this->Html->safe($item['price']) : null);?></strong>
                                        </td>
                                    </tr>
                                <?php
                                }
                                ?>
                            </tbody>
                        </table>
                        <hr>

                        <?php
                        if ((isset($summary['totals']) ? $summary['totals'] : null)) {
                        ?>
                        <table class="table table-curved">
                            <tbody>
                                <tr>
                                    <td><?php $this->_('Summary.index.totals.subtotal');?></td>
                                    <td><span class="price-col float-right currency_value"><strong><?php echo (isset($summary['totals']['subtotal']['amount_formatted']) ? $this->Html->safe($summary['totals']['subtotal']['amount_formatted']) : null);?></strong></span></td>
                                </tr>
                                <?php
                                if ((isset($summary['totals']['discount']['amount']) ? $summary['totals']['discount']['amount'] : null)) {
                                ?>
                                <tr>
                                    <td><?php $this->_('Summary.index.totals.discount');?></td>
                                    <td><span class="price-col float-right currency_value"><strong><?php echo (isset($summary['totals']['discount']['amount_formatted']) ? $this->Html->safe($summary['totals']['discount']['amount_formatted']) : null);?></strong></span></td>
                                </tr>
                                <?php
                                }
                                if ((isset($summary['totals']['tax']) ? $summary['totals']['tax'] : null)) {
                                    foreach ($summary['totals']['tax'] as $description => $tax) {
                                ?>
                                    <tr>
                                        <td><?php $this->_('Summary.index.totals.tax', false, $description);?></td>
                                        <td><span class="price-col float-right currency_value"><strong><?php echo (isset($tax['amount_formatted']) ? $this->Html->safe($tax['amount_formatted']) : null);?></strong></span></td>
                                    </tr>
                                <?php
                                    }
                                }
                                ?>
                            </tbody>
                        </table>
                        <hr>
                        <?php
                        }
                        ?>

                        <div class="row">
                            <div class="col-md-6">
                                <?php
                                if ((isset($order_form->allow_coupons) ? $order_form->allow_coupons : null) == '1') {
                                ?>
                                    <p class="mb-2"><a href="#coupon_box" class="font-weight-bolder" data-toggle="collapse"><i class="fas fa-tag"></i> <?php $this->_('Summary.index.have_coupon');?></a></p>
                                    <div id="coupon_box" class="collapse">
                                        <?php
                                        $this->Form->create((isset($this->base_uri) ? $this->base_uri : null) . 'order/cart/applycoupon/' . (isset($order_form->label) ? $order_form->label : null), ['id' => 'applycoupon']);
                                        ?>
                                        <div class="input-group">
                                            <?php
                                            if ((isset($summary['cart']['coupon']) ? $summary['cart']['coupon'] : null)) {
                                            ?>
                                            <span class="input-group-prepend">
                                                <span class="input-group-text"><i class="fas fa-check fa-fw"></i></span>
                                            </span>
                                            <?php
                                            }
                                            $this->Form->fieldText('coupon', (isset($summary['cart']['coupon']) ? $summary['cart']['coupon'] : (isset($temp_coupon) ? $temp_coupon : null)), ['class' => 'form-control' . ((isset($summary['cart']['coupon']) ? $summary['cart']['coupon'] : null) ? ' is-valid' : ''), 'id' => 'coupon', 'placeholder' => $this->_('Summary.index.coupon', true)]);
                                            ?>
                                            <div class="input-group-append">
                                                <button class="btn <?php echo ((isset($summary['cart']['coupon']) ? $summary['cart']['coupon'] : null) ? 'btn-success' : 'btn-secondary');?> m-0" type="submit"><i class="fas fa-sync-alt"></i> <?php $this->_('Summary.index.coupon_btn');?></button>
                                            </div>
                                        </div>
                                        <?php
                                        $this->Form->end();
                                        ?>
                                    </div>
                                <?php
                                }
                                ?>
                            </div>
                            <div class="col-md-6 total-due">
                                <?php
                                if ((isset($summary['totals']) ? $summary['totals'] : null)) {
                                ?>
                                    <small><?php $this->_('Summary.index.totals.total');?></small>
                                    <h4><strong class="currency_value"><?php echo (isset($summary['totals']['total']['amount_formatted']) ? $this->Html->safe($summary['totals']['total']['amount_formatted']) : null);?></strong></h4>
                                <?php
                                }

                                if ((isset($summary['totals_recurring']) ? $summary['totals_recurring'] : null)) {
                                ?>
                                    <small><?php $this->_('Summary.index.totals.total_recurring');?></small>
                                    <p>
                                    <?php
                                    $i = 0;
                                    foreach ($summary['totals_recurring'] as $totals) {
                                        // Determine the period to use
                                        $term = $this->Html->safe($totals['term']);
                                        $period = $this->Html->safe(($term == 1 ? (isset($periods[$totals['period']]) ? $periods[$totals['period']] : null) : (isset($periods[$totals['period'] . '_plural']) ? $periods[$totals['period'] . '_plural'] : null)), true);
                                        $amount = $this->Html->safe($totals['totals']['total']['amount_formatted']);

                                        if ($i++ > 0) {
                                        ?>
                                        <br />
                                        <?php
                                        }
                                        ?>
                                        <strong><?php $this->_('Summary.index.totals.total_recurring_amount', false, $term, $period, $amount);?></strong>
                                        <?php
                                    }
                                    unset($i);
                                    ?>
                                    </p>
                                    <?php
                                }
                                ?>
                            </div>
                        </div>
                    </div>
                </div>
                <?php
                $this->Form->create($this->base_uri . 'order/cart/removeAll/' . (isset($order_form->label) ? $order_form->label : null), ['class' => 'disable-on-submit']);
                $this->Form->fieldHidden('redirect_to', $this->base_uri . 'order/main/index/' . (isset($order_form->label) ? $order_form->label : null));
                ?>
                    <button type="submit" class="btn btn-light float-right" id="empty_cart">
                        <i class="fas fa-trash"></i> <?php $this->_('Summary.index.empty_cart');?>
                    </button>
                <?php
                $this->Form->end();
                ?>
                <div class="clearfix"></div>
            </div>
            <div id="payment-method">
                <?php
                $this->Form->create($this->base_uri . 'order/checkout/index/' . (isset($order_form->label) ? $order_form->label : null), ['id' => 'checkout_form']);
                $this->Form->fieldHidden('agree_tos', '');
                $this->Form->fieldHidden('set_vars', 'true');
                ?>
                    <div class="section-title">
                        <h3><i class="fas fa-check-circle"></i> <?php $this->_('Summary.index.heading_paymethods');?></h3>
                        <p><?php $this->_('Summary.index.paymethods_note');?></p>
                    </div>
                    <div class="card card-order">
                        <div class="card-body">
                            <?php
                            // Show column for new payment types, if any
                            if (!empty($payment_types)) {
                                foreach ((isset($payment_types) ? $payment_types : []) as $key => $value) {
                            ?>
                                <div class="radio">
                                    <label>
                                        <?php
                                        $this->Form->fieldRadio('payment_type', $key, (isset($vars->payment_type) ? $vars->payment_type : null) == $key, ['class' => 'payment_type']);
                                        echo (isset($value) ? $this->Html->safe($value) : null);
                                        ?>
                                    </label>
                                </div>
                            <?php
                                }
                            }

                            $nonmerchant_gateways = (isset($nonmerchant_gateways) ? $nonmerchant_gateways : []);
                            if (!empty($nonmerchant_gateways)) {
                            ?>
                                <?php
                                // Set non-merchant gateways
                                foreach ((isset($nonmerchant_gateways) ? $nonmerchant_gateways : []) as $gateway) {
                                ?>
                                <div class="radio">
                                    <label>
                                        <?php
                                        $this->Form->fieldRadio('gateway', ($gateway->id ?? null), (($vars->gateway ?? null) == ($gateway->id ?? null) || (count($payment_types) == 0 && count($nonmerchant_gateways) == 1)), ['class' => 'gateway']);
                                        echo (isset($gateway->name) ? $this->Html->safe($gateway->name) : null);
                                        ?>
                                    </label>
                                </div>
                                <?php
                                }
                                ?>
                            <?php
                            }
                            ?>
                        </div>
                    </div>
                <?php
                $this->Form->end();
                ?>
            </div>

<script type="text/javascript" src="<?php echo $this->Html->safe($this->view_dir . 'javascript/summary.js');?>"></script>
<?php
// Attempt to auto-apply a temp coupon by submitting the coupon form
if (!empty($temp_coupon) && empty($summary['cart']['coupon'])) {
?>
<script type="text/javascript">
$(document).ready(function() {
    $('#applycoupon').trigger('submit');
});
</script>
<?php
}
?>