<?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-2024 The OpenMage Contributors (https://www.openmage.org)
 * @license     https://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>

<?php
/**
 * Template for displaying product price at catalog and sidebars
 *
 * @var Mage_Catalog_Block_Product_Price $this
 */
?>
<?php
    /** @var Mage_Catalog_Model_Product $_product */
    $_product = $this->getProduct();
    $_msrpPrice = "";
?>
    <div class="price-box map-info">
    <?php $_price = $this->helper('tax')->getPrice($_product, $_product->getMsrp()) ?>
        <?php if ($_product->getMsrp()): ?>
            <?php $_msrpPrice = $this->helper('core')->currency($_product->getMsrp(),true,true) ?>
            <span class="old-price" id="product-price-<?php echo $_product->getId() ?><?php echo $this->getIdSuffix() ?>"><?php echo $_msrpPrice ?></span>
        <?php endif ?>
        <?php $helpLinkId = 'msrp-click-' . $_product->getId() . $this->helper('core')->getRandomString(20); ?>
        <a href="#" class="map-link" id="<?php echo($helpLinkId);?>"><?php echo $this->__('Click for price') ?></a>
        <script type="text/javascript">
            <?php if ($this->helper('catalog')->isShowPriceOnGesture($_product)): ?>
                var newLink = Catalog.Map.addHelpLink(
                        $('<?php echo $helpLinkId ?>'),
                        "<?php echo $this->escapeHtml($_product->getName()) ?>",
                        <?php echo $this->getRealPriceJs($_product) ?>,
                        '<?php echo $_msrpPrice ?>',
                        "<?php echo $_product->isSalable() ? $this->getAddToCartUrlCustom($_product, [], false) : '' ?>"
                );
                newLink.product_id = '<?php echo $_product->getId() ?>';
            <?php else: ?>
                Catalog.Map.addHelpLink(
                        $('<?php echo $helpLinkId ?>'),
                        "<?php echo $this->escapeHtml($_product->getName()) ?>",
                        null,
                        null,
                        "<?php echo $_product->getProductUrl() ?>"
                );
            <?php endif ?>

        </script>
    </div>
