Skip to content

Commit

Permalink
MAGETWO-70329: [GITHUB] The rich snippets are giving a warning for th…
Browse files Browse the repository at this point in the history
…e element price #7173
  • Loading branch information
dhorytskyi committed Apr 23, 2018
1 parent c85abb4 commit 21a72ca
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ $minProduct = $block->getSaleableItem()
->getMinProduct();

if ($minProduct) {
$finalPrice = $minProduct->getPriceInfo()->getPrice('final_price');
$finalPriceValue = $finalPrice->getAmount();
$amountRender = $block->getRendererPool()
->createAmountRender(
$minProduct->getPriceInfo()->getPrice('final_price')->getAmount(),
$finalPriceValue,
$minProduct,
$minProduct->getPriceInfo()->getPrice('final_price'),
$finalPrice,
['include_container' => true]
);
$currencyCode = $amountRender->getDisplayCurrencyCode();
} else {
$finalPriceValue = 0;
$currencyCode = '';
}
?>
<div class="price-box" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
Expand All @@ -32,4 +38,6 @@ if ($minProduct) {
<span class="price-label"><?php /* @escapeNotVerified */ echo __('Starting at')?></span><?php echo $amountRender->toHtml();?>
</p>
<?php endif ?>
<meta itemprop="price" content="<?php /* @noEscape */ echo $finalPriceValue; ?>" />
<meta itemprop="priceCurrency" content="<?php /* @noEscape */ echo $currencyCode; ?>" />
</div>

0 comments on commit 21a72ca

Please sign in to comment.