<?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)
 */
/** @var Mage_Catalog_Block_Product_Compare_Sidebar $this */
?>
<?php
$_helper = $this->helper('catalog/product_compare');
$_items = $_helper->getItemCount() > 0 ? $_helper->getItemCollection() : null;
?>
<?php if ($_items): ?>
<div class="block block-list block-compare">
    <div class="block-title">
        <strong><span><?= $this->__('Compare Products') ?>
            <?php if($_helper->getItemCount() > 0): ?>
                <small><?= $this->__('(%d)', $_helper->getItemCount()) ?></small>
            <?php endif ?>
        </span></strong>
    </div>
    <div class="block-content">
    <?php if($_helper->getItemCount() > 0): ?>
        <ol id="compare-items">
        <?php foreach($_items as $_index => $_item): ?>
            <li class="item">
                <input type="hidden" class="compare-item-id" value="<?= $_item->getId() ?>" />
                <a href="<?= $_helper->getRemoveUrl($_item) ?>" title="<?= $this->quoteEscape($this->__('Remove This Item')) ?>" class="btn-remove" onclick="return confirm('<?= Mage::helper('core')->jsQuoteEscape($this->__('Are you sure you would like to remove this item from the compare products?')) ?>');"><?= $this->__('Remove This Item') ?></a>
                <p class="product-name"><a href="<?= $this->getProductUrl($_item) ?>"><?= $this->helper('catalog/output')->productAttribute($_item, $_item->getName(), 'name') ?></a></p>
            </li>
        <?php endforeach ?>
        </ol>
        <div class="actions">
            <button type="button" title="<?= Mage::helper('core')->quoteEscape($this->__('Compare')) ?>" class="button" onclick="popWin('<?= $_helper->getListUrl() ?>','compare','top:0,left:0,width=820,height=600,resizable=yes,scrollbars=yes')"><?= $this->__('Compare') ?></button>
            <a href="<?= $_helper->getClearListUrl() ?>" onclick="return confirm('<?= Mage::helper('core')->jsQuoteEscape($this->__('Are you sure you would like to remove all products from your comparison?')) ?>');"><?= $this->__('Clear All') ?></a>
        </div>
    <?php else: ?>
        <p class="empty"><?= $this->__('You have no items to compare.') ?></p>
    <?php endif ?>
    </div>
</div>
<?php endif ?>
