core/modules/shop/template/checkout.phtml

Summary

Maintainability
Test Coverage
<?php
/* @var $this Ajde_Template_Parser_Phtml_Helper */

/* @var $transaction Ajde_Shop_Transaction */
$transaction = $this->transaction;

/** @var Ajde_Shop_Cart $cart */
$cart = $this->cart;
?>

<div class="container main">

    <div class="page-header">
        <h2><?php echo trans('Checkout', 'shop'); ?></h2>
    </div>

    <div class="row form-group">
        <div class="col-xs-12">
            <ul class="nav nav-pills nav-justified thumbnail setup-panel">
                <li class="active">
                    <a>
                        <h4 class="list-group-item-heading">1. <?php echo trans('Review', 'shop'); ?></h4>
                        <p class="list-group-item-text"><?php echo trans('Review your shopping cart', 'shop'); ?></p>
                    </a>
                </li>
                <li class="disabled">
                    <a>
                        <h4 class="list-group-item-heading">2. <?php echo trans('Your details', 'shop'); ?></h4>
                        <p class="list-group-item-text"><?php echo trans('Your name, address and shipping'); ?></p>
                    </a>
                </li>
                <li class="disabled">
                    <a>
                        <h4 class="list-group-item-heading">3. <?php echo trans('Payment', 'shop'); ?></h4>
                        <p class="list-group-item-text"><?php echo trans('Payment and order confirmation'); ?></p>
                    </a>
                </li>
            </ul>
        </div>
    </div>

    <?php if ($transaction->hasLoaded() && !$transaction->isSameAsCart($cart)) { ?>

        <h4><?php echo trans('You have an unfinished order', 'shop'); ?></h4>

        <?php if ($transaction->payment_status == 'pending') { ?>

            <?php if ($cart->hasItems()) { ?>

                <p>
                    <?php echo trans('Update this order in progress by replacing the items from your cart in the current order', 'shop'); ?>:
                </p>

                <?php echo $this->includeModule('shop/cart:widget'); ?>

                <div class='toolbar'>
                    <a class='btn btn-success btn-lg pull-right' href='shop/transaction:update'>
                        <?php echo trans('Update order', 'shop'); ?>
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </a>
                    <a href='shop/transaction:view'><?php echo trans('View current order', 'shop'); ?></a>
                </div>

            <?php } else { ?>

                <p>
                    <?php echo trans('You have no items in your shopping cart, but you can continue or cancel the current order', 'shop'); ?>
                </p>
                <a class='btn btn-info' href='shop/transaction:view'><?php echo trans('View current order', 'shop'); ?></a>

            <?php } ?>

        <?php } else { ?>

            <p><?php echo trans('There is a order in progress which can not be updated, as payment has already been initialized', 'shop'); ?>.</p>
            <a class='btn btn-info' href='shop/transaction:view'><?php echo trans('View current order', 'shop'); ?></a>
            <?php echo trans('or', 'shop'); ?>
            <a href='shop/transaction:startNew'><?php echo trans('create a new order', 'shop'); ?></a>

        <?php } ?>

    <?php } else { ?>

        <h4><?php echo trans('Review your shopping cart', 'shop'); ?></h4>
        <?php echo $this->includeModule('shop/cart:widget'); ?>
        <p class="text-right">
            <a class='btn btn-default btn-sm' href="shop/cart:edit"><?php echo trans('Edit shopping cart', 'shop'); ?></a>
        </p>

        <?php if (config("shop.offerLogin") && !$transaction->hasLoaded()) { ?>

            <hr/>

            <?php if ($this->user) { ?>
                <h4><?php echo trans('You are currently logged in as', 'shop'); ?>: <?php echo esc($this->user->getFullname()); ?></h4>
                <p><?php echo trans('We use your account info to pre-fill some details for your order.', 'shop'); ?></p>
                <p><a class='btn btn-info btn-sm' href='shop/cart:switchUser?returnto=shop/checkout'><?php echo trans('Switch user', 'shop'); ?></a></p>
            <?php } else { ?>
                <h4><?php echo trans('You are not currently logged in', 'shop'); ?></h4>
                <p>
                    <?php echo trans('We\'ll gladly take your order, but if you plan on coming back soon, please take some time to register yourself so you won\'t need to fill out your details in the future.', 'shop'); ?>
                </p>
                <p>
                    <a href='user/logon?returnto=shop/checkout' class='btn btn-info btn-sm'><?php echo trans('Login now', 'shop'); ?></a>
                    <?php echo trans('Or if you don\'t have an account yet', 'shop'); ?> <a href='user/register?returnto=shop/checkout'><?php echo trans('register for an account', 'shop'); ?></a>.
                </p>
            <?php } ?>

        <?php } ?>

        <?php if ($this->cart->hasItems()) { ?>
            <?php if ($transaction->hasLoaded() && $transaction->isSameAsCart($cart)) { ?>
                <div class='toolbar text-right'>
                    <a class='btn btn-success btn-lg' href='shop/transaction:update'>
                        <?php echo trans('Proceed with checkout', 'shop'); ?>
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </a>
                </div>
            <?php } else { ?>
                <div class='toolbar text-right'>
                    <a class='btn btn-success btn-lg' href='shop/transaction:setup'>
                        <?php echo trans('Proceed with checkout', 'shop'); ?>
                        <span class="glyphicon glyphicon-chevron-right"></span>
                    </a>
                </div>
            <?php } ?>
        <?php } else { ?>
            <hr/>
            <p>
                <a class='action' href='shop'><?php echo trans('', 'shop'); ?>
                    <?php echo trans('Do some shopping first', 'shop'); ?>
                </a>
            </p>
        <?php } ?>
    <?php } ?>

</div>