0

I have upgraded magento from 2.1.8 EE to 2.3.1 Ee. After upgrade the product page layout is not rendering features. Below is the code of my detail.phtml file -

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

// @codingStandardsIgnoreFile
// @var $block \Magento\Catalog\Block\Product\View\Attributes

?>
<?php 

    $_helper = $this->helper('Magento\Catalog\Helper\Output');
    $_product = $block->getProduct();

    ?>


   <?php if ($detailedInfoGroup = $block->getGroupChildNames('detailed_info', 'getChildHtml')):
?>
    <div class="product info detailed">
        <?php $layout = $block->getLayout(); ?>
        <div class="product data items" data-mage-init='{"tabs":{"openedState":"active"}}'>
            <?php foreach ($detailedInfoGroup as $name):?>
                <?php
                    $html = $layout->renderElement($name);
                  $len = strlen($html);
                  if($len!=164) {
                    if (!trim($html)) {
                        continue;
                    }
                    $alias = $layout->getElementAlias($name);
                    $label = $block->getChildData($alias, 'title');
                    if ($label == "Details") {
                        $label = "Description";
                    }
                    if ($label == "More Information") {
                        $label = "Details";
                    }
                ?>
                <div class="data item title"
                     aria-labeledby="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title"
                     data-role="collapsible" id="tab-label-<?= /* @escapeNotVerified */ $alias ?>">
                    <a class="data switch"
                       tabindex="-1"
                       data-toggle="switch"
                       href="#<?= /* @escapeNotVerified */ $alias ?>"
                       id="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title">
                        <?= /* @escapeNotVerified */ $label ?>
                    </a>
                </div>
                <div class="data item content" id="<?= /* @escapeNotVerified */ $alias ?>" data-role="content">
                    <?= /* @escapeNotVerified */ $html ?>
                    <?php
                        if ($label == "Description") {
                        if ($detailedInfoFeatures = $block->getGroupChildNames('bd_features', 'getChildHtml')):
                            $featurelayout = $block->getLayout();
                    ?>
                        <ul class="bd-description-features">
                        <?php foreach ($detailedInfoFeatures as $featureName):?>
                        <?php
                            $featurehtml = $featurelayout->renderElement($featureName);
                            $flen= strlen($featurehtml);
                            if (!trim($featurehtml)) {
                                continue;
                            }
                        ?>
                        <?php if($flen!=164){ ?>
                            <li><?= /* @escapeNotVerified */ $featurehtml ?></li>
                            <?php } ?>
                        <?php
                            endforeach;
                            endif;
                        ?>
                        </ul>
                    <?php
                        }
                    ?>
                </div>
                 <?php } ?>
            <?php endforeach;?>
        </div>
    </div>
<?php endif; ?>

The issue is it's not rendering the <ul class="bd-description-features> ul structure of features. I did var_dump($block->getGroupSortedChildNames('bd_features', 'getChildHtml')) ; in template file, and it gives output as array(0) { } .

This template was working fine for magento 2.1.8 but in magento 2.3.1 it's showing the value of $block->getGroupSortedChildNames('bd_features', 'getChildHtml') as empty.

Please provide a solution.

Your Answer

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

Browse other questions tagged or ask your own question.