-2

I want to display text/attribute in product detail page - magento 2.3.2.

In Magento 1.9.4 we can code in view.phtml file located under public_html/app/design/frontend/rwd/default/template/catalog/product to achieve this result.

But In Magento 2.3.2 there is no view.phtml file. anyone please let me know where & how to code to display text/attribute in product detail page - magento 2.3.2

  • sku already display in product detail page. – Rk Rathod Aug 19 at 12:15
  • consider it as to display text/ any attribute – Paresh Aug 19 at 12:20
  • $_product->getCustomAttributte() – Rk Rathod Aug 19 at 12:22
  • can you please give more in detail.... location of file, name of file and exact code if my attribute name to display is 'exam' – Paresh Aug 19 at 12:27
  • in which location ?? – Rk Rathod Aug 19 at 12:28
0

Override: /app/design/frontend/Themename/campponyname/Magento_Catalog/templates/product/view/

vendor/magento/module-catalog/view/frontend/templates/product/view

<?php 
try { $product_description = $_item->getData('attributeName');
if ( $product_description && strlen($product_description) ) {
?><div class="desciption">
<p><?= $product_description ?></p></div><?php
}
} catch(Exception $e) {}
?>   

For catalog page: path:app/design/frontend/themename/companyname/Magento_Catalog/templates/product/list.phtml


 <?php 
$attr = $_product->getData('attributename');
if ( $attr && strlen($attr) ) {
?><div class="whatever"><p><?= $attr ?></p></div><?php
}
?>
  • pl.let me know exact file name to code...to display in product detail page. (like you mentioned list.phtml for catalogue page) – Paresh Aug 19 at 13:13
  • /vendor/magento/module-catalog/view/frontend/templates/product/view check this path this path contain all product page files you have to check all file that are placed in this folder and change you code accordingly – Izhar Mehdi Aug 19 at 13:17
  • if i want to display attribute just above product image which file out of product page files I have to code & what code to mention. – Paresh Aug 19 at 13:54
  • vendor/magento/module-catalog/view/frontend/templates/product/view/gallery.phtml – Izhar Mehdi Aug 19 at 16:49
  • it is not working..for me – Paresh Aug 20 at 3:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.