| Current Path : /home/rtorresani/www/vendor/magento/module-msrp/view/base/templates/product/price/ |
| Current File : //home/rtorresani/www/vendor/magento/module-msrp/view/base/templates/product/price/msrp.phtml |
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Template for displaying product price at product view page, gift registry and wish-list
*
* @var $block \Magento\Msrp\Pricing\Render\PriceBox
* @var \Magento\Framework\View\Helper\SecureHtmlRenderer $secureRenderer
*/
?>
<?php
/** @var Magento\Msrp\Pricing\Price\MsrpPriceInterface $priceType */
$priceType = $block->getPrice();
/** @var $product \Magento\Catalog\Model\Product */
$product = $block->getSaleableItem();
$productId = $product->getId();
$amount = $block->getMsrpPriceCalculator()->getMsrpPriceValue($product);
$msrpPrice = $block->renderAmount(
$priceType->getCustomAmount($amount),
[
'price_id' => $block->getPriceId() ? $block->getPriceId() : 'old-price-' . $productId,
'include_container' => false,
'skip_adjustments' => true
]
);
$priceElementIdPrefix = $block->getPriceElementIdPrefix() ? $block->getPriceElementIdPrefix() : 'product-price-';
?>
<?php if ($amount): ?>
<span class="old-price map-old-price"><?= /* @noEscape */ $msrpPrice ?></span>
<span class="map-fallback-price normal-price"><?= /* @noEscape */ $msrpPrice ?></span>
<?php endif; ?>
<?php if ($priceType->isShowPriceOnGesture()): ?>
<?php
$addToCartUrl = '';
if ($product->isSaleable()) {
/** @var Magento\Catalog\Block\Product\AbstractProduct $addToCartUrlGenerator */
$addToCartUrlGenerator = $block->getLayout()->getBlockSingleton(
\Magento\Catalog\Block\Product\AbstractProduct::class
);
// phpcs:disable
$addToCartUrl = $addToCartUrlGenerator->getAddToCartUrl(
$product,
['_query' => [
\Magento\Framework\App\ActionInterface::PARAM_NAME_URL_ENCODED =>
$this->helper(\Magento\Framework\Url\Helper\Data::class)->getEncodedUrl(
$addToCartUrlGenerator->getAddToCartUrl($product)
),
]]
);
// phpcs:enable
}
$priceElementId = $priceElementIdPrefix . $productId . $block->getIdSuffix();
$popupId = 'msrp-popup-' . $productId . $block->getRandomString(20);
$data = [
'origin'=> 'msrp',
'popupId' => '#' . $popupId,
'productName' => $block->escapeJs($block->escapeHtml($product->getName())),
'productId' => $productId,
'productIdInput' => 'input[type="hidden"][name="product"]',
'realPrice' => $block->getRealPriceHtml(),
'isSaleable' => $product->isSaleable(),
'msrpPrice' => $msrpPrice,
'priceElementId' => $priceElementId,
'closeButtonId' => '#map-popup-close',
'addToCartUrl' => $addToCartUrl,
'paymentButtons' => '[data-label=or]'
];
if ($block->getRequest()->getFullActionName() === 'catalog_product_view') {
$data['addToCartButton'] = '#product_addtocart_form [type=submit]';
} else {
$data['addToCartButton'] = sprintf(
'form:has(input[type="hidden"][name="product"][value="%1$s"]) button[type="submit"],' .
'.block.widget .price-box[data-product-id="%1$s"]+.product-item-actions button.tocart',
$productId
);
}
?>
<?php $priceId = $block->escapeHtmlAttr($block->getPriceId() ? $block->getPriceId() : $priceElementId); ?>
<span id="s_<?= /* @noEscape*/ $priceId ?>"></span>
<?= /* @noEscape */ $secureRenderer->renderStyleAsTag("display:none", 'span#s_' . $priceId) ?>
<a href="#"
id="<?= /* @noEscape */ ($popupId) ?>"
class="action map-show-info"
data-mage-init='{"addToCart":<?= /* @noEscape */ $block->jsonEncode($data) ?>}'>
<?= $block->escapeHtml(__('Click for price')) ?>
</a>
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
'onclick',
'event.preventDefault()',
'a#' . /* @noEscape */ ($popupId)
) ?>
<?php else: ?>
<span class="msrp-message">
<?= $block->escapeHtml($priceType->getMsrpPriceMessage()) ?>
</span>
<?php endif; ?>
<?php if ($block->getZone() == \Magento\Framework\Pricing\Render::ZONE_ITEM_VIEW): ?>
<?php $helpLinkId = 'msrp-help-' . $productId . $block->getRandomString(20); ?>
<a href="#"
id="<?= /* @noEscape */ $helpLinkId ?>"
class="action map-show-info"
data-mage-init='{"addToCart":{"origin": "info",
"helpLinkId": "#<?= /* @noEscape */ $helpLinkId ?>",
"productName": "<?= $block->escapeJs($product->getName()) ?>",
"closeButtonId": "#map-popup-close"}}'>
<span><?= $block->escapeHtml(__("What's this?")) ?></span>
</a>
<?= /* @noEscape */ $secureRenderer->renderEventListenerAsTag(
'onclick',
'event.preventDefault()',
'a#' . /* @noEscape */ $helpLinkId
) ?>
<?php endif; ?>