0

I tried to display the short description of a grouped product in grouped.phtml:

<?php if ($_hasAssociatedProducts): ?>
            <?php foreach ($_associatedProducts as $_item): ?>
                <?php if ($_product->isSaleable()): ?>    
                    <div class="custom-box"><?php echo $block->escapeHtml($_item->getShortDescription()) ?></div>
                <?php endif; ?>
            <?php endforeach; ?>
        <?php endif; ?>

But nothing is displayed like this. Any idea why?

2
  • is it magento2 or magento 1?
    – Raghu
    Jul 21 '17 at 9:12
  • magento2. The code is working but the short description is not displayed
    – d3rick
    Jul 21 '17 at 9:13
1

$_assosicatedProducts does not holds all the informations like short description. $_item holds only following informations

Array
(
    [entity_id] => 33
    [attribute_set_id] => 13
    [type_id] => simple
    [sku] => 24-WG085
    [has_options] => 0
    [required_options] => 0
    [created_at] => 2017-04-20 10:17:40
    [updated_at] => 2017-04-20 10:17:40
    [inventory_in_stock] => 1
    [status] => 1
    [is_salable] => 1
    [link_id] => 1
    [position] => 0
    [qty] => 0.0000
    [name] => Sprite Yoga Strap 6 foot
    [price] => 14.0000
)

You can retrieve the product short description by loading explicitly with the help of ID / SKU.

1
  • i know few data only getting from that array. I need short_description of the array. Oct 3 '19 at 11:47

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.