<?php
/**
 * Maho
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://magento.com)
 * @copyright   Copyright (c) 2021-2022 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)
 */
?>
<?php if ($_products = $this->getRecentlyComparedProducts()): ?>
<div class="widget widget-compared">
    <div class="block block-products">
        <div class="block-title">
            <strong><span><?= $this->__('Recently Compared') ?></span></strong>
        </div>
        <div class="block-content">
            <?php $suffix = $this->getNameInLayout(); ?>
            <ol class="mini-products-list" id="widget-compared-<?= $suffix ?>">
            <?php foreach ($_products as $_product): ?>
                <li class="item">
                    <a class="product-image" href="<?= $_product->getProductUrl() ?>" title="<?= $this->stripTags($_product->getName(), null, true) ?>"><img src="<?= $this->helper('catalog/image')->init($_product, 'thumbnail')->resize(50) ?>" width="50" height="50" alt="<?= $this->stripTags($_product->getName(), null, true) ?>" /></a>
                    <div class="product-details">
                        <p class="product-name"><a href="<?= $_product->getProductUrl() ?>" title="<?= $this->stripTags($_product->getName(), null, true) ?>)"><?= $this->helper('catalog/output')->productAttribute($_product, $_product->getName() , 'name') ?></a></p>
                        <?= $this->getPriceHtml($_product, true, '-widget-compared-'.$suffix) ?>
                        <?php if($_product->isSaleable()): ?>
                            <a href="<?= $this->getAddToCartUrl($_product) ?>" class="link-cart"><?= $this->__('Add to Cart') ?></a>
                        <?php else: ?>
                            <p class="availability out-of-stock"><span><?= $this->__('Out of stock') ?></span></p>
                        <?php endif ?>
                    </div>
                </li>
            <?php endforeach ?>
            </ol>
        </div>
    </div>
</div>
<?php endif ?>
