I have installed magneto 2.4.5 and trying to show manufacturer above product title .
I have set custom theme using Luma as base , I have found many example of showing custom attribute on the product page , but none actually show any attribute on my page. I am not sure if there are some changes in latest version of magento 2 or I m doing something wrong.
also I Like to know if is possible to link manufacturer to either search result or Custom CMS page.
I appreciate any help with this little matter.
Thanks.
I am using following code
in catalog_product_view.xml
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceContainer name="product.info.main">
<block class="MagentoCatalogBlockProductView" name="product.attribute.custom" template="Magento_Catalog::product/view/attribute/custom.phtml">
<arguments>
<argument name="title" translate="true" xsi:type="string">Your Custom Attribute Title</argument>
</arguments>
</block>
</referenceContainer>
</body>
</page>```
and custom.phthml
```<?php
$product = $block->getProduct();
$attrData = $product->getData('{attributeCode}');
$blockTitle = $this->getData('title');
if (trim($attrData) !== "") : ?>
<div class="product-full-width-section">
<h2 class="product-section-title"><?= $blockTitle; ?></h2>
<?php echo $attrData; ?>
</div>
<?php endif; ?>```
Checking magento 2 system.log file , i noticed warning . about template path
`product/view/attribute/custom.phtml`
I have created this path as shown in above code and i have modified to different paths , but I keep getting this warning.
This is the warning in system.log file.
```Invalid template file: 'Magento_Catalog::product/view/attribute/custom.phtml' in module: 'Magento_Catalog' block's name: 'product.attribute.custom'```