<?php
/**
 * Maho
 *
 * @category    design
 * @package     rwd_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2024 The OpenMage Contributors (https://openmage.org)
 * @copyright   Copyright (c) 2024 Maho (https://mahocommerce.com)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */

/**
 * Shoping cart sidebar
 *
 * @see Mage_Checkout_Block_Cart_Sidebar
 * @var Mage_Checkout_Block_Cart_Sidebar $this 
 */

?>
<?php if ($this->getIsNeedToDisplaySideBar()):?>
<div class="block block-cart">
    <?php $_cartQty = $this->getSummaryCount() ?>
    <div class="block-title">
        <strong><span><?= $this->__('My Cart') ?></span></strong>
    </div>
    <div class="block-content">
    <?php if ($_cartQty>0): ?>
        <div class="summary">
            <?php if ($_cartQty==1): ?>
                <p class="amount"><?= $this->__('There is <a href="%s">1 item</a> in your cart.', $this->getUrl('checkout/cart')) ?></p>
            <?php else: ?>
                <p class="amount"><?= $this->__('There are <a href="%s">%s items</a> in your cart.', $this->getUrl('checkout/cart'), $_cartQty) ?></p>
            <?php endif ?>
            <p class="subtotal">
                <?php if ($this->canApplyMsrp()): ?>
                    <span class="map-cart-sidebar-total"><?= $this->__('ORDER TOTAL WILL BE DISPLAYED BEFORE YOU SUBMIT THE ORDER') ?></span>
                <?php else: ?>
                    <span class="label"><?= $this->__('Cart Subtotal:') ?></span> <?= Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
                    <?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
                        <br />(<?= Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?= Mage::helper('tax')->getIncExcText(true) ?>)
                    <?php endif ?>
                <?php endif ?>
            </p>
        </div>
    <?php endif ?>
    <?php $_items = $this->getRecentItems() ?>
    <?php if(count($_items)): ?>
        <p class="block-subtitle"><?= $this->__('Recently added item(s)') ?></p>
        <ol id="cart-sidebar" class="mini-products-list">
        <?php foreach($_items as $_item): ?>
            <?= $this->getItemHtml($_item) ?>
        <?php endforeach ?>
        </ol>
    <?php else: ?>
        <p class="empty"><?= $this->__('You have no items in your shopping cart.') ?></p>
    <?php endif ?>
    <?php if($_cartQty && $this->isPossibleOnepageCheckout()): ?>
        <div class="actions">
            <?= $this->getChildHtml('extra_actions') ?>
            <button type="button" title="<?= Mage::helper('core')->quoteEscape($this->__('Checkout')) ?>" class="button" onclick="setLocation('<?= $this->getCheckoutUrl() ?>')"><?= $this->__('Checkout') ?></button>
        </div>
    <?php endif ?>
    </div>
</div>
<?php endif ?>
