0

I just started to learn Magento2 and never dealt with Magento before. I have custom theme where in wishlist I need to show product description. So here

/app/design/frontend/Vendor/Theme/Magento_Wishlist/templates/item/column

in name.phtml I tried to get product description but without success.

I have tried this

$this->helper('Magento\Catalog\Helper\Output')->productAttribute($block->getProduct(), $block->getProduct()->getDescription(), 'description')

but it didn't work.

Currently the code of name.phtml looks like

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

/* @var \Magento\Wishlist\Model\Item $item */


$item = $block->getItem();
$product = $item->getProduct();



?>
<div class="col-lg-5">
  <strong class="product-item-name">
    <a href="<?php /* @escapeNotVerified */ echo $block->getProductUrl($item) ?>" title="<?php echo $block->escapeHtml($product->getName()) ?>" class="product-item-link">
        <?php echo $block->escapeHtml($product->getName()) ?>           
    </a>
  </strong>
<?php //echo $helper_desc->getProductDescription($item) ?>
</div>

I need to get description on this line

<?php //echo $helper_desc->getProductDescription($item) ?>

Could you please help to get product description in name.phtml? If this matters site is on production mode.

1 Answer 1

0

Try with this

<?php echo $item->getAttributeText('attribute_name'); ?>

Works if the attribute is a dropdown

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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