<?php
/**
 * OpenMage
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available at https://opensource.org/license/afl-3-0-php
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2006-2020 Magento, Inc. (https://www.magento.com)
 * @copyright   Copyright (c) 2021-2022 The OpenMage Contributors (https://www.openmage.org)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>

<?php $_wishlistItem = $this->getWishlistItem(); ?>
<?php $_wishlistSubmitUrl = $this->helper('wishlist')->getUpdateUrl($_wishlistItem); ?>
<ul class="add-to-links">
<?php if ($this->helper('wishlist')->isAllow()) : ?>
    <li><a href="<?php echo $_wishlistSubmitUrl ?>" onclick="productAddToCartForm.submitLight(this, this.href); return false;" class="link-compare"><?php echo $this->__('Update Wishlist') ?></a></li>
<?php endif ?>
<?php $_product = $this->getProduct(); ?>
<?php $_compareUrl = $this->helper('catalog/product_compare')->getAddUrlCustom($_product, false); ?>
<?php if ($_compareUrl) : ?>
    <li>
        <span class="separator">|</span>
        <a href="#"
           class="link-compare"
           onclick="customFormSubmit(
                   '<?php echo $_compareUrl ?>',
                   '<?php echo $this->escapeHtml(json_encode(['form_key' => $this->getFormKey()])) ?>',
                   'post')">
            <?php echo $this->__('Add to Compare') ?>
        </a>
    </li>
<?php endif ?>
</ul>
