0

How to display all attributes of a product like default and custom attributes on a product view page at just right side to the product.

Note: I don't want to display at tab or anywhere.

0

I found the solution.

First create new file at this path :

magento/vendor/magento/module_catelog/view/frontend/templates/product/view/attributes_productpage.phtml

code:

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

// @codingStandardsIgnoreFile

/**
 * Product additional attributes template
 *
 * @var $block \Magento\Catalog\Block\Product\View\Attributes
 */
?>
<?php
    $_helper = $this->helper('Magento\Catalog\Helper\Output');
    $_product = $block->getProduct();
?>
<?php if ($_additional = $block->getAdditionalData()): ?>
    <div class="additional-attributes-wrapper table-wrapper">
        <table class="data table additional-attributes" id="product-attribute-specs-table1">
            <caption class="table-caption"><?= /* @escapeNotVerified */ __('More Information') ?></caption>
            <tbody>
            <?php foreach ($_additional as $_data): ?>
                <tr>
                    <th class="col label" scope="row"><?= $block->escapeHtml(__($_data['label'])) ?></th>
                    <td class="col data" data-th="<?= $block->escapeHtml(__($_data['label'])) ?>"><?= /* @escapeNotVerified */ $_helper->productAttribute($_product, $_data['value'], $_data['code']) ?></td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    </div>
<?php endif;?>

Go to your theme folder

magento/app/design/frontend//magento-catalog/catalog_product_view.xml

OR

magento/vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml

file. Add these code to this file:

    <block class="Magento\Catalog\Block\Product\View\Attributes" name="product.attributes1"  template="product/view/attributes_productpage.phtml" > 
    </block>

<move element="product.attributes1" destination="product.info.main" after="product.info.demo"/> 

Now flush all cache memory and data, Reload your product page.

For flush, run this command:

php bin/magento c:f

You can see this: enter image description here

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.