<?php /* Shopping cart contents */ ?>
<div class="am-basket-preview">
<?php
$hasQty = false;
foreach ($cart->getItems() as $item) {
    $hasQty = $hasQty || $item->qty > 1;
}
?>
<?php if (count($cart->getItems())) : ?>
    <table class="am-basket-preview-items">
    <?php foreach ($cart->getItems() as $item): ?>
    <tr class="am-basket-preview-item">
        <td class="am-basket-preview-item-remove"><?php if (!$cart->isStick($item)):?><a href="javascript:;" title="<?php __e('Remove') ?>" onclick='cart.remove(<?= json_encode(['id' => $item->item_id, 'type' => $item->item_type]); ?>)'>&#10005;</a><?php endif ?></td>
        <td class="am-basket-preview-item-title"><div><?php p($item->item_title) ?></div></td>
        <?php if ($hasQty) : ?>
        <td class="am-basket-preview-item-qty">&times;<?php p($item->qty) ?></td>
        <?php endif; ?>
        <td class="am-basket-preview-item-total"><?php p($cart->getCurrency($item->first_total)) ?></td>
    </tr>
    <?php endforeach ?>
    <tr class="am-basket-preview-total">
        <td class="am-basket-preview-cart-remove"></td>
        <td class="am-basket-preview-cart-title" colspan="<?= $hasQty ? 2 : 1 ?>"><?php p('Total') ?></td>
        <td class="am-basket-preview-cart-total"><?php p($cart->getCurrency($cart->getInvoice()->first_total)) ?></td>
    </tr>
    </table>
    <div class="am-basket-preview-actions">
        <a href="<?php echo $di->surl('cart/view-basket') ?>"><?php __e('View Basket')?></a>
        <span class="am-basket-preview-actions-divider">|</span>
        <a href="<?php echo $di->surl('cart/checkout') ?>"><?php __e('Checkout')?></a>
    </div>
<?php else: ?>
    <div class="am-basket-preview-empty">
        <?php __e('Your cart is empty. Click %shere%s to continue shopping.', '<a href="' . $di->surl('cart') . '">', '</a>') ?>
    </div>
<?php endif; ?>
</div>