Skip to content

Commit

Permalink
Merge pull request #2437 from magento-tango/MAGETWO-70329-2
Browse files Browse the repository at this point in the history
MAGETWO-70329 [GITHUB] The rich snippets are giving a warning for the element price #7173
  • Loading branch information
dhorytskyi authored Apr 24, 2018
2 parents b5580f4 + 74ee5d7 commit c462a13
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,11 @@
class="price-wrapper <?php /* @escapeNotVerified */ echo $block->getPriceWrapperCss(); ?>">
<?php /* @noEscape */ echo $block->formatCurrency($block->getDisplayValue(), (bool)$block->getIncludeContainer()) ?>
</span>
<?php if ($block->getSchema()): ?>
<span class="_hidden" itemprop="price">
<?php /* @noEscape */ echo $block->getDisplayValue() ?>
</span>
<?php endif; ?>
<?php if ($block->hasAdjustmentsHtml()): ?>
<?php echo $block->getAdjustmentsHtml() ?>
<?php endif; ?>
<?php if ($block->getSchema()): ?>
<meta itemprop="price" content="<?php /* @noEscape */ echo $block->getDisplayValue(); ?>" />
<meta itemprop="priceCurrency" content="<?php /* @escapeNotVerified */ echo $block->getDisplayCurrencyCode()?>" />
<?php endif; ?>
</span>
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>
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,6 @@
&:last-child {
margin-bottom: 0;
}

&._hidden {
display: none;
}
}
}
}
Expand Down

0 comments on commit c462a13

Please sign in to comment.