Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- * Copyright © 2016 Magento. All rights reserved.
- * See COPYING.txt for license details.
- */
- // @codingStandardsIgnoreFile
- ?>
- <?php
- /** @var MagentoCatalogPricingRenderFinalPriceBox $block */
- $productId = $block->getSaleableItem()->getId();
- /** ex: MagentoCatalogPricingPriceRegularPrice */
- /** @var MagentoFrameworkPricingPricePriceInterface $priceModel */
- $priceModel = $block->getPriceType('regular_price');
- /** ex: MagentoCatalogPricingPriceFinalPrice */
- /** @var MagentoFrameworkPricingPricePriceInterface $finalPriceModel */
- $finalPriceModel = $block->getPriceType('final_price');
- $idSuffix = $block->getIdSuffix() ? $block->getIdSuffix() : '';
- $schema = ($block->getZone() == 'item_view') ? true : false;
- ?>
- <?php if ($block->getSaleableItem()->getFinalPrice() == 0): ?>
- <span class="price-on-request">
- <?php echo __('Price on Request'); ?>
- <span>
- <?php else: ?>
- <?php if ($block->getPriceType('custom_price')->getCustomAmount() < $block->getPriceType('custom_price')->getCustomAmount(null,null,['regular_price'=>True,'price_type'=>'custom_price'])): ?>
- <span class="special-price">
- <?php /* @escapeNotVerified */ echo $block->renderAmount($block->getPriceType('custom_price')->getCustomAmount(), [
- 'display_label' => __('Special Price'),
- 'price_id' => $block->getPriceId('custom-special-price-' . $idSuffix),
- 'price_type' => 'custom_price',
- 'include_container' => true,
- 'schema' => $schema
- ]); ?>
- </span>
- <span class="old-price">
- <?php /* @escapeNotVerified */ echo $block->renderAmount($block->getPriceType('custom_price')->getCustomAmount(null,null,['regular_price'=>True,'price_type'=>'custom_price_regular']), [
- 'display_label' => __('Regular Price'),
- 'price_id' => $block->getPriceId('custom-price-' . $idSuffix),
- 'price_type' => 'custom_price',
- 'include_container' => true,
- 'skip_adjustments' => true
- ]); ?>
- </span>
- <?php elseif ($block->hasSpecialPrice()): ?>
- <span class="special-price">
- <?php /* @escapeNotVerified */ echo $block->renderAmount($finalPriceModel->getAmount(), [
- 'display_label' => __('Special Price'),
- 'price_id' => $block->getPriceId('product-price-' . $idSuffix),
- 'price_type' => 'finalPrice',
- 'include_container' => true,
- 'schema' => $schema
- ]); ?>
- </span>
- <span class="old-price">
- <?php /* @escapeNotVerified */ echo $block->renderAmount($priceModel->getAmount(), [
- 'display_label' => __('Regular Price'),
- 'price_id' => $block->getPriceId('old-price-' . $idSuffix),
- 'price_type' => 'oldPrice',
- 'include_container' => true,
- 'skip_adjustments' => true
- ]); ?>
- </span>
- <?php else: ?>
- <?php /* @escapeNotVerified */ echo $block->renderAmount($block->getPriceType('final_price')->getCustomAmount(null,null,['price_type'=>'final_price']), [
- 'price_id' => $block->getPriceId('product-price-' . $idSuffix),
- 'price_type' => 'finalPrice',
- 'include_container' => true,
- 'schema' => $schema
- ]); ?>
- <?php endif; ?>
- <?php if ($block->showMinimalPrice()): ?>
- <?php if ($block->getUseLinkForAsLowAs()):?>
- <a href="<?php /* @escapeNotVerified */ echo $block->getSaleableItem()->getProductUrl(); ?>" class="minimal-price-link">
- <?php /* @escapeNotVerified */ echo $block->renderAmountMinimal(); ?>
- </a>
- <?php else:?>
- <span class="minimal-price-link">
- <?php /* @escapeNotVerified */ echo $block->renderAmountMinimal(); ?>
- </span>
- <?php endif?>
- <?php endif; ?>
- <?php endif; ?>
- /**
- * @param MagentoCheckoutBlockCartItemRenderer $subject
- * @param $result
- * @return string
- */
- public function afterGetUnitPriceHtml(
- MagentoCheckoutBlockCartItemRenderer $subject,
- $result
- ) {
- if ($subject->getProduct()->getFinalPrice() > 0) {
- return $result;
- }
- return __('Price on Request');
- }
- /**
- * @param MagentoCheckoutBlockCartItemRenderer $subject
- * @param $result
- * @return string
- */
- public function afterGetRowTotalHtml(
- MagentoCheckoutBlockCartItemRenderer $subject,
- $result
- ) {
- if ($subject->getProduct()->getFinalPrice() > 0) {
- return $result;
- }
- return __('Price on Request');
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement