How to Display Attribute Group Name in Product Tab Magento 2.1.3
You can get Attribute group name using attribute code and attribute set id.
Try the following code once:
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$productCollection = $objectManager->create('Magento\Eav\Model\ResourceModel\Entity\Attribute\Group\Collection');
$productCollection->addAttributeToSelect('*');
$productCollection->addFieldToFilter('attribute_set_id',4)->addAttributeToSort('attribute_set_id', 'asc');
$productCollection->load();
foreach ($productCollection as $key => $value)
{
echo '<pre>'; print_r($value->getData());
}
Or check the below link.
magento-2-get-product-attributes-attribute-groups/
I hope it will help you!
Hi @optimyle_optimy ,
Try to make a module and create a view layout "catalog_product_view.xml". Add xml
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="product.info.details">
<block class="Magento\Catalog\Block\Product\View" name="tab.tab" template="OverrideProductTab_Producttab:roducttab.phtml" group="detailed_info" >
<arguments>
<argument translate="true" name="title" xsi:type="string">Group Attribute</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>
</referenceBlock>
create a templates producttab.phtml add the line.
<?php $product = $block->getProduct(); ?>
<h1 style="color: #ff6e17"><?php echo $product->getData('producttab'); ?></h1>
After that run the below command.
sudo php bin/magento setup:static-content:deploy
sudo php bin/magento cache:clean
sudo php bin/magento cache:flush
After that product tab will be display and add logic here.
If my answer is useful, please Accept as Solution & give Kudos