Skip to content

Commit f007b9a

Browse files
committed
ACP2E-2266: add meta itemprop in head
1 parent 7d1c377 commit f007b9a

File tree

4 files changed

+95
-0
lines changed

4 files changed

+95
-0
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/************************************************************************
4+
*
5+
* ADOBE CONFIDENTIAL
6+
* ___________________
7+
*
8+
* Copyright 2023 Adobe
9+
* All Rights Reserved.
10+
*
11+
* NOTICE: All information contained herein is, and remains
12+
* the itemprop of Adobe and its suppliers, if any. The intellectual
13+
* and technical concepts contained herein are proprietary to Adobe
14+
* and its suppliers and are protected by all applicable intellectual
15+
* itemprop laws, including trade secret and copyright laws.
16+
* Dissemination of this information or reproduction of this material
17+
* is strictly forbidden unless prior written permission is obtained
18+
* from Adobe.
19+
* ************************************************************************
20+
*/
21+
-->
22+
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
23+
<body>
24+
<referenceBlock name="head.additional">
25+
<block class="Magento\Catalog\Block\Product\View" name="microdata.general" template="Magento_Catalog::product/view/microdata/general.phtml">
26+
<block class="Magento\Directory\Block\Currency" name="microdata.currency" as="meta.currency" template="Magento_Catalog::product/view/microdata/currency.phtml"/>
27+
</block>
28+
</referenceBlock>
29+
</body>
30+
</page>

app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
<css src="mage/gallery/gallery.css"/>
1111
</head>
1212
<update handle="catalog_product_opengraph" />
13+
<update handle="catalog_product_microdata" />
1314
<update handle="page_calendar"/>
1415
<body>
1516
<attribute name="itemtype" value="http://schema.org/Product" />
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
<?php
2+
/************************************************************************
3+
*
4+
* ADOBE CONFIDENTIAL
5+
* ___________________
6+
*
7+
* Copyright 2023 Adobe
8+
* All Rights Reserved.
9+
*
10+
* NOTICE: All information contained herein is, and remains
11+
* the itemprop of Adobe and its suppliers, if any. The intellectual
12+
* and technical concepts contained herein are proprietary to Adobe
13+
* and its suppliers and are protected by all applicable intellectual
14+
* itemprop laws, including trade secret and copyright laws.
15+
* Dissemination of this information or reproduction of this material
16+
* is strictly forbidden unless prior written permission is obtained
17+
* from Adobe.
18+
* ************************************************************************
19+
*/
20+
21+
/** @var $block \Magento\Directory\Block\Currency */
22+
?>
23+
24+
<meta itemprop="priceCurrency" content="<?= $block->stripTags($block->getCurrentCurrencyCode()); ?>"/>
25+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?php
2+
/************************************************************************
3+
*
4+
* ADOBE CONFIDENTIAL
5+
* ___________________
6+
*
7+
* Copyright 2023 Adobe
8+
* All Rights Reserved.
9+
*
10+
* NOTICE: All information contained herein is, and remains
11+
* the itemprop of Adobe and its suppliers, if any. The intellectual
12+
* and technical concepts contained herein are proprietary to Adobe
13+
* and its suppliers and are protected by all applicable intellectual
14+
* itemprop laws, including trade secret and copyright laws.
15+
* Dissemination of this information or reproduction of this material
16+
* is strictly forbidden unless prior written permission is obtained
17+
* from Adobe.
18+
* ************************************************************************
19+
*/
20+
21+
/** @var $block \Magento\Catalog\Block\Product\View */
22+
/** @var $escaper \Magento\Framework\Escaper */
23+
/** @var $block \Magento\Directory\Block\Currency */
24+
?>
25+
26+
<meta itemprop="name"
27+
content="<?= $escaper->escapeHtml($block->stripTags($block->getProduct()->getName())) ?>" />
28+
<meta itemprop="image"
29+
content="<?= $escaper->escapeUrl($block->getImage($block->getProduct(), 'product_base_image')->getImageUrl()) ?>" />
30+
<meta itemprop="sku" content="<?= $escaper->escapeHtml($block->getProduct()->getSku());?>" />
31+
<meta itemprop="description"
32+
content="<?= $escaper->escapeHtmlAttr($block->stripTags($block->getProduct()->getShortDescription())) ?>" />
33+
<?php if ($priceAmount = $block->getProduct()
34+
->getPriceInfo()
35+
->getPrice(\Magento\Catalog\Pricing\Price\FinalPrice::PRICE_CODE)
36+
->getAmount()):?>
37+
<meta itemprop="price" content="<?= $escaper->escapeHtmlAttr($priceAmount) ?>"/>
38+
<?= $block->getChildHtml('meta.currency') ?>
39+
<?php endif;?>

0 commit comments

Comments
 (0)