My Custom product tab not displaying in Magento 2












5















I am trying to inject my custom product tab in storefront on product view page, but it's not displaying. For this I am written below code.



registration.php



<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Test_ProductTabs',
__DIR__
);


Test/ProductTabs/Block/CustomTab.php



<?php
namespace TestProductTabsBlock;

use MagentoCatalogModelProduct;

class CustomTab extends MagentoFrameworkViewElementTemplate{

/**
* @var Product
*/
protected $_product = null;

/**
* Core registry
*
* @var MagentoFrameworkRegistry
*/
protected $_coreRegistry = null;

/**
* @param MagentoFrameworkViewElementTemplateContext $context
* @param MagentoFrameworkRegistry $registry
* @param array $data
*/
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
MagentoFrameworkRegistry $registry,
array $data =
) {
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
}

/**
* @return Product
*/
public function getProduct()
{
if (!$this->_product) {
$this->_product = $this->_coreRegistry->registry('product');
}
return $this->_product;
}

}


Test/ProductTabs/etc/module.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Test_ProductTabs" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>


Test/ProductTabs/view/layout/catalog_product_view.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="TestProductTabsBlockCustomTab" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
<arguments>
<argument name="title" translate="true" xsi:type="string">Kit Components</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


Test/ProductTabs/view/templates/kit.phtml



<h1>Kit Components</h1>


above code is not working for me. Any help on this?










share|improve this question

























  • Your controller file?

    – Nitin Pawar
    Nov 17 '16 at 10:39











  • @NitinPawar is it required?

    – Bojjaiah
    Nov 17 '16 at 10:40











  • Yes whenever i create the page i write controller for that page

    – Nitin Pawar
    Nov 17 '16 at 10:42











  • @NitinPawar I think not required. I am creating storefront. any way how can i link up with tab to controller? can you share the code if it possible?

    – Bojjaiah
    Nov 17 '16 at 10:44











  • @NitinPawar any help on this?

    – Bojjaiah
    Nov 17 '16 at 10:50
















5















I am trying to inject my custom product tab in storefront on product view page, but it's not displaying. For this I am written below code.



registration.php



<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Test_ProductTabs',
__DIR__
);


Test/ProductTabs/Block/CustomTab.php



<?php
namespace TestProductTabsBlock;

use MagentoCatalogModelProduct;

class CustomTab extends MagentoFrameworkViewElementTemplate{

/**
* @var Product
*/
protected $_product = null;

/**
* Core registry
*
* @var MagentoFrameworkRegistry
*/
protected $_coreRegistry = null;

/**
* @param MagentoFrameworkViewElementTemplateContext $context
* @param MagentoFrameworkRegistry $registry
* @param array $data
*/
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
MagentoFrameworkRegistry $registry,
array $data =
) {
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
}

/**
* @return Product
*/
public function getProduct()
{
if (!$this->_product) {
$this->_product = $this->_coreRegistry->registry('product');
}
return $this->_product;
}

}


Test/ProductTabs/etc/module.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Test_ProductTabs" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>


Test/ProductTabs/view/layout/catalog_product_view.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="TestProductTabsBlockCustomTab" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
<arguments>
<argument name="title" translate="true" xsi:type="string">Kit Components</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


Test/ProductTabs/view/templates/kit.phtml



<h1>Kit Components</h1>


above code is not working for me. Any help on this?










share|improve this question

























  • Your controller file?

    – Nitin Pawar
    Nov 17 '16 at 10:39











  • @NitinPawar is it required?

    – Bojjaiah
    Nov 17 '16 at 10:40











  • Yes whenever i create the page i write controller for that page

    – Nitin Pawar
    Nov 17 '16 at 10:42











  • @NitinPawar I think not required. I am creating storefront. any way how can i link up with tab to controller? can you share the code if it possible?

    – Bojjaiah
    Nov 17 '16 at 10:44











  • @NitinPawar any help on this?

    – Bojjaiah
    Nov 17 '16 at 10:50














5












5








5








I am trying to inject my custom product tab in storefront on product view page, but it's not displaying. For this I am written below code.



registration.php



<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Test_ProductTabs',
__DIR__
);


Test/ProductTabs/Block/CustomTab.php



<?php
namespace TestProductTabsBlock;

use MagentoCatalogModelProduct;

class CustomTab extends MagentoFrameworkViewElementTemplate{

/**
* @var Product
*/
protected $_product = null;

/**
* Core registry
*
* @var MagentoFrameworkRegistry
*/
protected $_coreRegistry = null;

/**
* @param MagentoFrameworkViewElementTemplateContext $context
* @param MagentoFrameworkRegistry $registry
* @param array $data
*/
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
MagentoFrameworkRegistry $registry,
array $data =
) {
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
}

/**
* @return Product
*/
public function getProduct()
{
if (!$this->_product) {
$this->_product = $this->_coreRegistry->registry('product');
}
return $this->_product;
}

}


Test/ProductTabs/etc/module.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Test_ProductTabs" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>


Test/ProductTabs/view/layout/catalog_product_view.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="TestProductTabsBlockCustomTab" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
<arguments>
<argument name="title" translate="true" xsi:type="string">Kit Components</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


Test/ProductTabs/view/templates/kit.phtml



<h1>Kit Components</h1>


above code is not working for me. Any help on this?










share|improve this question
















I am trying to inject my custom product tab in storefront on product view page, but it's not displaying. For this I am written below code.



registration.php



<?php
MagentoFrameworkComponentComponentRegistrar::register(
MagentoFrameworkComponentComponentRegistrar::MODULE,
'Test_ProductTabs',
__DIR__
);


Test/ProductTabs/Block/CustomTab.php



<?php
namespace TestProductTabsBlock;

use MagentoCatalogModelProduct;

class CustomTab extends MagentoFrameworkViewElementTemplate{

/**
* @var Product
*/
protected $_product = null;

/**
* Core registry
*
* @var MagentoFrameworkRegistry
*/
protected $_coreRegistry = null;

/**
* @param MagentoFrameworkViewElementTemplateContext $context
* @param MagentoFrameworkRegistry $registry
* @param array $data
*/
public function __construct(
MagentoFrameworkViewElementTemplateContext $context,
MagentoFrameworkRegistry $registry,
array $data =
) {
$this->_coreRegistry = $registry;
parent::__construct($context, $data);
}

/**
* @return Product
*/
public function getProduct()
{
if (!$this->_product) {
$this->_product = $this->_coreRegistry->registry('product');
}
return $this->_product;
}

}


Test/ProductTabs/etc/module.xml



<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Test_ProductTabs" setup_version="1.0.0">
<sequence>
<module name="Magento_Catalog"/>
</sequence>
</module>
</config>


Test/ProductTabs/view/layout/catalog_product_view.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="TestProductTabsBlockCustomTab" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
<arguments>
<argument name="title" translate="true" xsi:type="string">Kit Components</argument>
</arguments>
</block>
</referenceBlock>
</body>
</page>


Test/ProductTabs/view/templates/kit.phtml



<h1>Kit Components</h1>


above code is not working for me. Any help on this?







product magento-2.1 tabs






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 17 '16 at 11:35







Bojjaiah

















asked Nov 17 '16 at 10:38









BojjaiahBojjaiah

2,4802571




2,4802571













  • Your controller file?

    – Nitin Pawar
    Nov 17 '16 at 10:39











  • @NitinPawar is it required?

    – Bojjaiah
    Nov 17 '16 at 10:40











  • Yes whenever i create the page i write controller for that page

    – Nitin Pawar
    Nov 17 '16 at 10:42











  • @NitinPawar I think not required. I am creating storefront. any way how can i link up with tab to controller? can you share the code if it possible?

    – Bojjaiah
    Nov 17 '16 at 10:44











  • @NitinPawar any help on this?

    – Bojjaiah
    Nov 17 '16 at 10:50



















  • Your controller file?

    – Nitin Pawar
    Nov 17 '16 at 10:39











  • @NitinPawar is it required?

    – Bojjaiah
    Nov 17 '16 at 10:40











  • Yes whenever i create the page i write controller for that page

    – Nitin Pawar
    Nov 17 '16 at 10:42











  • @NitinPawar I think not required. I am creating storefront. any way how can i link up with tab to controller? can you share the code if it possible?

    – Bojjaiah
    Nov 17 '16 at 10:44











  • @NitinPawar any help on this?

    – Bojjaiah
    Nov 17 '16 at 10:50

















Your controller file?

– Nitin Pawar
Nov 17 '16 at 10:39





Your controller file?

– Nitin Pawar
Nov 17 '16 at 10:39













@NitinPawar is it required?

– Bojjaiah
Nov 17 '16 at 10:40





@NitinPawar is it required?

– Bojjaiah
Nov 17 '16 at 10:40













Yes whenever i create the page i write controller for that page

– Nitin Pawar
Nov 17 '16 at 10:42





Yes whenever i create the page i write controller for that page

– Nitin Pawar
Nov 17 '16 at 10:42













@NitinPawar I think not required. I am creating storefront. any way how can i link up with tab to controller? can you share the code if it possible?

– Bojjaiah
Nov 17 '16 at 10:44





@NitinPawar I think not required. I am creating storefront. any way how can i link up with tab to controller? can you share the code if it possible?

– Bojjaiah
Nov 17 '16 at 10:44













@NitinPawar any help on this?

– Bojjaiah
Nov 17 '16 at 10:50





@NitinPawar any help on this?

– Bojjaiah
Nov 17 '16 at 10:50










5 Answers
5






active

oldest

votes


















6














Try this in your layout file



<referenceBlock name="product.info.details">

<block class="MagentoCatalogBlockProductView" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Kit Components</argument>
</arguments>
</block>

</referenceBlock>


product related details all are available in MagentoCatalogBlockProductView so no need to create custom block for get product details.



update



wrong layout file location! it should be



Test/ProductTabs/view/frontend/layout/catalog_product_view.xml






share|improve this answer


























  • not working....

    – Bojjaiah
    Nov 17 '16 at 11:17











  • wrong layout location see my updated answer

    – Bilal Usean
    Nov 17 '16 at 11:22






  • 1





    Yes I have wrongly created folder structure. I forgot it. Thanks you. Is there any way to display @ 1 tab as my custom tab?

    – Bojjaiah
    Nov 17 '16 at 11:37





















3














You code is fine just simple mistake you have done two mistake



please change file name



catalog_product_view_.xml


to



catalog_product_view.xml


change frontend layout and tempplate file location



Test/ProductTabs/view/layout/catalog_product_view_.xml


to



Test/ProductTabs/view/frontend/layout/catalog_product_view.xml


change template file location



Test/ProductTabs/view/templates/kit.phtml


to



Test/ProductTabs/view/frontend/templates/kit.phtml





share|improve this answer
























  • that is typing mistake any way thanks bro...

    – Bojjaiah
    Nov 17 '16 at 11:38











  • Is there any way to display @ 1 tab as my custom tab?

    – Bojjaiah
    Nov 17 '16 at 11:39











  • @magentotwo refer link magento.stackexchange.com/questions/110796/…

    – Prashant Valanda
    Nov 17 '16 at 11:54



















2














Try this code of layout:



   <referenceContainer name="content">
<referenceBlock name="product.info.details">
<block class="TestProductTabsBlockCustomTab" name="customtab_display" template="template="Test_ProductTabs::kit.phtml" group="detailed_info">
<arguments>
<argument translate="true" name="title" xsi:type="string">Kit Components</argument>
</arguments>
</block>
</referenceBlock>
</referenceContainer>





share|improve this answer


























  • not working....

    – Bojjaiah
    Nov 17 '16 at 10:58











  • remove /var and apply reindex and cache:flush

    – Ronak Chauhan
    Nov 17 '16 at 11:00











  • yes I executed above commands cache:flush, cache:clean and indexer:reindex but no luck.

    – Bojjaiah
    Nov 17 '16 at 11:06











  • may be you have issue in block so please remove getProduct() then try again

    – Ronak Chauhan
    Nov 17 '16 at 11:10






  • 1





    for that you need to rewrite catalog view but here we are override that page

    – Ronak Chauhan
    Nov 17 '16 at 11:40



















1















  1. First go to the admin panel of your Magento store and then navigate to
    Stores -> Product. Click on Add New Attribute and create new Attribute. (Set Attribute label DEMO and Attribute code demo)


  2. Now go to Stores -> Attribute Set and Add Attribute Set.


  3. Now click on your Attribute Set and dragged unassigned Attribute (which you have created in first step) to Product Details and click Save.


  4. Now go to your product edit page in admin panel and change the attribute name and template name which you have created in first and second step.


  5. In app/code/Test/ProductTabs/etc/module.xml paste this code.
    <?xml version="1.0"?>
    <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
    <module name="Test_ProductTabs" setup_version="1.0.0"></module>
    </config>


  6. In app/code/Test/ProductTabs/registration.php, paste this code.
    <?php
    MagentoFrameworkComponentComponentRegistrar::register(
    MagentoFrameworkComponentComponentRegistrar::MODULE,
    'Test_ProductTabs',
    __DIR__
    );


  7. In app/code/Test/ProductTabs/view/frontend/layout/catalog_product_view.xml, paste this code.
    <?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="MagentoCatalogBlockProductView" name="demo.tab" template="Test_ProductTabs::custom_tab.phtml" group="detailed_info" >
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Custom Tab</argument>
    </arguments>
    </block>
    </referenceBlock>
    </body>
    </page>


  8. Now in app/code/Test/ProductTabs/view/frontend/templates/custom_tab.phtml, paste this code.
    <?php
    $product = $block->getProduct();
    ?>
    <h1 style="color: #00aeed"><?php echo $product->getData('demo'); ?></h1>


  9. Now lauch your product page.







share|improve this answer


























  • Create a whole module just to call echo $product->getData('demo'); in a custom template file? It seems easier to extend catalog_product_view.xml in the Theme - either by re-using the MagentoCatalogBlockProductViewDescription block as described by @Holly, or even by adding your custom custom_tab.phtml to the theme.

    – thaddeusmt
    Oct 9 '17 at 4:07











  • Nicely explain and helpful

    – Nitesh
    Nov 26 '17 at 12:34



















1














I think the better way to do this is to follow the same approach Magento uses to add the description attribute as one of the tabs on the product details page.



First create your attribute, lets say it's tech_spec and add it to whichever attribute sets you want it to so I can be updated from the Manage Manage Products page.



Then create/update your appcode[NameSpace][ModuleName]viewfrontendlayoutcatalog_product_view.xml file with:



<referenceBlock name="product.info.details">
<block class="MagentoCatalogBlockProductViewDescription" name="product.info.tech.spec" template="product/view/attribute.phtml" group="detailed_info">
<arguments>
<argument name="at_call" xsi:type="string">getTechSpec</argument>
<argument name="at_code" xsi:type="string">tech_spec</argument>
<argument name="css_class" xsi:type="string">tech-spec</argument>
<argument name="at_label" xsi:type="string">none</argument>
<argument name="title" translate="true" xsi:type="string">Technical Specification</argument>
</arguments>
</block>
</referenceBlock>




Alternatively if you don't want to add an attribute you can add a template instead.



<referenceBlock name="product.info.details">
<block class="MagentoCatalogBlockProductView" name="product.info.tech.spec" template="Magento_Catalog::product/view/tech-spec.phtml" group="detailed_info" >
<arguments>
<argument translate="true" name="title" xsi:type="string">Technical Specification</argument>
</arguments>
</block>
</referenceBlock>





share|improve this answer

























    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "479"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f146229%2fmy-custom-product-tab-not-displaying-in-magento-2%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    6














    Try this in your layout file



    <referenceBlock name="product.info.details">

    <block class="MagentoCatalogBlockProductView" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Kit Components</argument>
    </arguments>
    </block>

    </referenceBlock>


    product related details all are available in MagentoCatalogBlockProductView so no need to create custom block for get product details.



    update



    wrong layout file location! it should be



    Test/ProductTabs/view/frontend/layout/catalog_product_view.xml






    share|improve this answer


























    • not working....

      – Bojjaiah
      Nov 17 '16 at 11:17











    • wrong layout location see my updated answer

      – Bilal Usean
      Nov 17 '16 at 11:22






    • 1





      Yes I have wrongly created folder structure. I forgot it. Thanks you. Is there any way to display @ 1 tab as my custom tab?

      – Bojjaiah
      Nov 17 '16 at 11:37


















    6














    Try this in your layout file



    <referenceBlock name="product.info.details">

    <block class="MagentoCatalogBlockProductView" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Kit Components</argument>
    </arguments>
    </block>

    </referenceBlock>


    product related details all are available in MagentoCatalogBlockProductView so no need to create custom block for get product details.



    update



    wrong layout file location! it should be



    Test/ProductTabs/view/frontend/layout/catalog_product_view.xml






    share|improve this answer


























    • not working....

      – Bojjaiah
      Nov 17 '16 at 11:17











    • wrong layout location see my updated answer

      – Bilal Usean
      Nov 17 '16 at 11:22






    • 1





      Yes I have wrongly created folder structure. I forgot it. Thanks you. Is there any way to display @ 1 tab as my custom tab?

      – Bojjaiah
      Nov 17 '16 at 11:37
















    6












    6








    6







    Try this in your layout file



    <referenceBlock name="product.info.details">

    <block class="MagentoCatalogBlockProductView" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Kit Components</argument>
    </arguments>
    </block>

    </referenceBlock>


    product related details all are available in MagentoCatalogBlockProductView so no need to create custom block for get product details.



    update



    wrong layout file location! it should be



    Test/ProductTabs/view/frontend/layout/catalog_product_view.xml






    share|improve this answer















    Try this in your layout file



    <referenceBlock name="product.info.details">

    <block class="MagentoCatalogBlockProductView" name="mycustom.tab" as="mycustom" template="Test_ProductTabs::kit.phtml" group="detailed_info">
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Kit Components</argument>
    </arguments>
    </block>

    </referenceBlock>


    product related details all are available in MagentoCatalogBlockProductView so no need to create custom block for get product details.



    update



    wrong layout file location! it should be



    Test/ProductTabs/view/frontend/layout/catalog_product_view.xml







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 17 '16 at 11:42

























    answered Nov 17 '16 at 11:07









    Bilal UseanBilal Usean

    4,90923689




    4,90923689













    • not working....

      – Bojjaiah
      Nov 17 '16 at 11:17











    • wrong layout location see my updated answer

      – Bilal Usean
      Nov 17 '16 at 11:22






    • 1





      Yes I have wrongly created folder structure. I forgot it. Thanks you. Is there any way to display @ 1 tab as my custom tab?

      – Bojjaiah
      Nov 17 '16 at 11:37





















    • not working....

      – Bojjaiah
      Nov 17 '16 at 11:17











    • wrong layout location see my updated answer

      – Bilal Usean
      Nov 17 '16 at 11:22






    • 1





      Yes I have wrongly created folder structure. I forgot it. Thanks you. Is there any way to display @ 1 tab as my custom tab?

      – Bojjaiah
      Nov 17 '16 at 11:37



















    not working....

    – Bojjaiah
    Nov 17 '16 at 11:17





    not working....

    – Bojjaiah
    Nov 17 '16 at 11:17













    wrong layout location see my updated answer

    – Bilal Usean
    Nov 17 '16 at 11:22





    wrong layout location see my updated answer

    – Bilal Usean
    Nov 17 '16 at 11:22




    1




    1





    Yes I have wrongly created folder structure. I forgot it. Thanks you. Is there any way to display @ 1 tab as my custom tab?

    – Bojjaiah
    Nov 17 '16 at 11:37







    Yes I have wrongly created folder structure. I forgot it. Thanks you. Is there any way to display @ 1 tab as my custom tab?

    – Bojjaiah
    Nov 17 '16 at 11:37















    3














    You code is fine just simple mistake you have done two mistake



    please change file name



    catalog_product_view_.xml


    to



    catalog_product_view.xml


    change frontend layout and tempplate file location



    Test/ProductTabs/view/layout/catalog_product_view_.xml


    to



    Test/ProductTabs/view/frontend/layout/catalog_product_view.xml


    change template file location



    Test/ProductTabs/view/templates/kit.phtml


    to



    Test/ProductTabs/view/frontend/templates/kit.phtml





    share|improve this answer
























    • that is typing mistake any way thanks bro...

      – Bojjaiah
      Nov 17 '16 at 11:38











    • Is there any way to display @ 1 tab as my custom tab?

      – Bojjaiah
      Nov 17 '16 at 11:39











    • @magentotwo refer link magento.stackexchange.com/questions/110796/…

      – Prashant Valanda
      Nov 17 '16 at 11:54
















    3














    You code is fine just simple mistake you have done two mistake



    please change file name



    catalog_product_view_.xml


    to



    catalog_product_view.xml


    change frontend layout and tempplate file location



    Test/ProductTabs/view/layout/catalog_product_view_.xml


    to



    Test/ProductTabs/view/frontend/layout/catalog_product_view.xml


    change template file location



    Test/ProductTabs/view/templates/kit.phtml


    to



    Test/ProductTabs/view/frontend/templates/kit.phtml





    share|improve this answer
























    • that is typing mistake any way thanks bro...

      – Bojjaiah
      Nov 17 '16 at 11:38











    • Is there any way to display @ 1 tab as my custom tab?

      – Bojjaiah
      Nov 17 '16 at 11:39











    • @magentotwo refer link magento.stackexchange.com/questions/110796/…

      – Prashant Valanda
      Nov 17 '16 at 11:54














    3












    3








    3







    You code is fine just simple mistake you have done two mistake



    please change file name



    catalog_product_view_.xml


    to



    catalog_product_view.xml


    change frontend layout and tempplate file location



    Test/ProductTabs/view/layout/catalog_product_view_.xml


    to



    Test/ProductTabs/view/frontend/layout/catalog_product_view.xml


    change template file location



    Test/ProductTabs/view/templates/kit.phtml


    to



    Test/ProductTabs/view/frontend/templates/kit.phtml





    share|improve this answer













    You code is fine just simple mistake you have done two mistake



    please change file name



    catalog_product_view_.xml


    to



    catalog_product_view.xml


    change frontend layout and tempplate file location



    Test/ProductTabs/view/layout/catalog_product_view_.xml


    to



    Test/ProductTabs/view/frontend/layout/catalog_product_view.xml


    change template file location



    Test/ProductTabs/view/templates/kit.phtml


    to



    Test/ProductTabs/view/frontend/templates/kit.phtml






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Nov 17 '16 at 11:32









    Prashant ValandaPrashant Valanda

    9,76912354




    9,76912354













    • that is typing mistake any way thanks bro...

      – Bojjaiah
      Nov 17 '16 at 11:38











    • Is there any way to display @ 1 tab as my custom tab?

      – Bojjaiah
      Nov 17 '16 at 11:39











    • @magentotwo refer link magento.stackexchange.com/questions/110796/…

      – Prashant Valanda
      Nov 17 '16 at 11:54



















    • that is typing mistake any way thanks bro...

      – Bojjaiah
      Nov 17 '16 at 11:38











    • Is there any way to display @ 1 tab as my custom tab?

      – Bojjaiah
      Nov 17 '16 at 11:39











    • @magentotwo refer link magento.stackexchange.com/questions/110796/…

      – Prashant Valanda
      Nov 17 '16 at 11:54

















    that is typing mistake any way thanks bro...

    – Bojjaiah
    Nov 17 '16 at 11:38





    that is typing mistake any way thanks bro...

    – Bojjaiah
    Nov 17 '16 at 11:38













    Is there any way to display @ 1 tab as my custom tab?

    – Bojjaiah
    Nov 17 '16 at 11:39





    Is there any way to display @ 1 tab as my custom tab?

    – Bojjaiah
    Nov 17 '16 at 11:39













    @magentotwo refer link magento.stackexchange.com/questions/110796/…

    – Prashant Valanda
    Nov 17 '16 at 11:54





    @magentotwo refer link magento.stackexchange.com/questions/110796/…

    – Prashant Valanda
    Nov 17 '16 at 11:54











    2














    Try this code of layout:



       <referenceContainer name="content">
    <referenceBlock name="product.info.details">
    <block class="TestProductTabsBlockCustomTab" name="customtab_display" template="template="Test_ProductTabs::kit.phtml" group="detailed_info">
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Kit Components</argument>
    </arguments>
    </block>
    </referenceBlock>
    </referenceContainer>





    share|improve this answer


























    • not working....

      – Bojjaiah
      Nov 17 '16 at 10:58











    • remove /var and apply reindex and cache:flush

      – Ronak Chauhan
      Nov 17 '16 at 11:00











    • yes I executed above commands cache:flush, cache:clean and indexer:reindex but no luck.

      – Bojjaiah
      Nov 17 '16 at 11:06











    • may be you have issue in block so please remove getProduct() then try again

      – Ronak Chauhan
      Nov 17 '16 at 11:10






    • 1





      for that you need to rewrite catalog view but here we are override that page

      – Ronak Chauhan
      Nov 17 '16 at 11:40
















    2














    Try this code of layout:



       <referenceContainer name="content">
    <referenceBlock name="product.info.details">
    <block class="TestProductTabsBlockCustomTab" name="customtab_display" template="template="Test_ProductTabs::kit.phtml" group="detailed_info">
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Kit Components</argument>
    </arguments>
    </block>
    </referenceBlock>
    </referenceContainer>





    share|improve this answer


























    • not working....

      – Bojjaiah
      Nov 17 '16 at 10:58











    • remove /var and apply reindex and cache:flush

      – Ronak Chauhan
      Nov 17 '16 at 11:00











    • yes I executed above commands cache:flush, cache:clean and indexer:reindex but no luck.

      – Bojjaiah
      Nov 17 '16 at 11:06











    • may be you have issue in block so please remove getProduct() then try again

      – Ronak Chauhan
      Nov 17 '16 at 11:10






    • 1





      for that you need to rewrite catalog view but here we are override that page

      – Ronak Chauhan
      Nov 17 '16 at 11:40














    2












    2








    2







    Try this code of layout:



       <referenceContainer name="content">
    <referenceBlock name="product.info.details">
    <block class="TestProductTabsBlockCustomTab" name="customtab_display" template="template="Test_ProductTabs::kit.phtml" group="detailed_info">
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Kit Components</argument>
    </arguments>
    </block>
    </referenceBlock>
    </referenceContainer>





    share|improve this answer















    Try this code of layout:



       <referenceContainer name="content">
    <referenceBlock name="product.info.details">
    <block class="TestProductTabsBlockCustomTab" name="customtab_display" template="template="Test_ProductTabs::kit.phtml" group="detailed_info">
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Kit Components</argument>
    </arguments>
    </block>
    </referenceBlock>
    </referenceContainer>






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 13 '17 at 9:01









    Murtuza Zabuawala

    12.5k73362




    12.5k73362










    answered Nov 17 '16 at 10:40









    Ronak ChauhanRonak Chauhan

    4,23011449




    4,23011449













    • not working....

      – Bojjaiah
      Nov 17 '16 at 10:58











    • remove /var and apply reindex and cache:flush

      – Ronak Chauhan
      Nov 17 '16 at 11:00











    • yes I executed above commands cache:flush, cache:clean and indexer:reindex but no luck.

      – Bojjaiah
      Nov 17 '16 at 11:06











    • may be you have issue in block so please remove getProduct() then try again

      – Ronak Chauhan
      Nov 17 '16 at 11:10






    • 1





      for that you need to rewrite catalog view but here we are override that page

      – Ronak Chauhan
      Nov 17 '16 at 11:40



















    • not working....

      – Bojjaiah
      Nov 17 '16 at 10:58











    • remove /var and apply reindex and cache:flush

      – Ronak Chauhan
      Nov 17 '16 at 11:00











    • yes I executed above commands cache:flush, cache:clean and indexer:reindex but no luck.

      – Bojjaiah
      Nov 17 '16 at 11:06











    • may be you have issue in block so please remove getProduct() then try again

      – Ronak Chauhan
      Nov 17 '16 at 11:10






    • 1





      for that you need to rewrite catalog view but here we are override that page

      – Ronak Chauhan
      Nov 17 '16 at 11:40

















    not working....

    – Bojjaiah
    Nov 17 '16 at 10:58





    not working....

    – Bojjaiah
    Nov 17 '16 at 10:58













    remove /var and apply reindex and cache:flush

    – Ronak Chauhan
    Nov 17 '16 at 11:00





    remove /var and apply reindex and cache:flush

    – Ronak Chauhan
    Nov 17 '16 at 11:00













    yes I executed above commands cache:flush, cache:clean and indexer:reindex but no luck.

    – Bojjaiah
    Nov 17 '16 at 11:06





    yes I executed above commands cache:flush, cache:clean and indexer:reindex but no luck.

    – Bojjaiah
    Nov 17 '16 at 11:06













    may be you have issue in block so please remove getProduct() then try again

    – Ronak Chauhan
    Nov 17 '16 at 11:10





    may be you have issue in block so please remove getProduct() then try again

    – Ronak Chauhan
    Nov 17 '16 at 11:10




    1




    1





    for that you need to rewrite catalog view but here we are override that page

    – Ronak Chauhan
    Nov 17 '16 at 11:40





    for that you need to rewrite catalog view but here we are override that page

    – Ronak Chauhan
    Nov 17 '16 at 11:40











    1















    1. First go to the admin panel of your Magento store and then navigate to
      Stores -> Product. Click on Add New Attribute and create new Attribute. (Set Attribute label DEMO and Attribute code demo)


    2. Now go to Stores -> Attribute Set and Add Attribute Set.


    3. Now click on your Attribute Set and dragged unassigned Attribute (which you have created in first step) to Product Details and click Save.


    4. Now go to your product edit page in admin panel and change the attribute name and template name which you have created in first and second step.


    5. In app/code/Test/ProductTabs/etc/module.xml paste this code.
      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
      <module name="Test_ProductTabs" setup_version="1.0.0"></module>
      </config>


    6. In app/code/Test/ProductTabs/registration.php, paste this code.
      <?php
      MagentoFrameworkComponentComponentRegistrar::register(
      MagentoFrameworkComponentComponentRegistrar::MODULE,
      'Test_ProductTabs',
      __DIR__
      );


    7. In app/code/Test/ProductTabs/view/frontend/layout/catalog_product_view.xml, paste this code.
      <?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="MagentoCatalogBlockProductView" name="demo.tab" template="Test_ProductTabs::custom_tab.phtml" group="detailed_info" >
      <arguments>
      <argument translate="true" name="title" xsi:type="string">Custom Tab</argument>
      </arguments>
      </block>
      </referenceBlock>
      </body>
      </page>


    8. Now in app/code/Test/ProductTabs/view/frontend/templates/custom_tab.phtml, paste this code.
      <?php
      $product = $block->getProduct();
      ?>
      <h1 style="color: #00aeed"><?php echo $product->getData('demo'); ?></h1>


    9. Now lauch your product page.







    share|improve this answer


























    • Create a whole module just to call echo $product->getData('demo'); in a custom template file? It seems easier to extend catalog_product_view.xml in the Theme - either by re-using the MagentoCatalogBlockProductViewDescription block as described by @Holly, or even by adding your custom custom_tab.phtml to the theme.

      – thaddeusmt
      Oct 9 '17 at 4:07











    • Nicely explain and helpful

      – Nitesh
      Nov 26 '17 at 12:34
















    1















    1. First go to the admin panel of your Magento store and then navigate to
      Stores -> Product. Click on Add New Attribute and create new Attribute. (Set Attribute label DEMO and Attribute code demo)


    2. Now go to Stores -> Attribute Set and Add Attribute Set.


    3. Now click on your Attribute Set and dragged unassigned Attribute (which you have created in first step) to Product Details and click Save.


    4. Now go to your product edit page in admin panel and change the attribute name and template name which you have created in first and second step.


    5. In app/code/Test/ProductTabs/etc/module.xml paste this code.
      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
      <module name="Test_ProductTabs" setup_version="1.0.0"></module>
      </config>


    6. In app/code/Test/ProductTabs/registration.php, paste this code.
      <?php
      MagentoFrameworkComponentComponentRegistrar::register(
      MagentoFrameworkComponentComponentRegistrar::MODULE,
      'Test_ProductTabs',
      __DIR__
      );


    7. In app/code/Test/ProductTabs/view/frontend/layout/catalog_product_view.xml, paste this code.
      <?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="MagentoCatalogBlockProductView" name="demo.tab" template="Test_ProductTabs::custom_tab.phtml" group="detailed_info" >
      <arguments>
      <argument translate="true" name="title" xsi:type="string">Custom Tab</argument>
      </arguments>
      </block>
      </referenceBlock>
      </body>
      </page>


    8. Now in app/code/Test/ProductTabs/view/frontend/templates/custom_tab.phtml, paste this code.
      <?php
      $product = $block->getProduct();
      ?>
      <h1 style="color: #00aeed"><?php echo $product->getData('demo'); ?></h1>


    9. Now lauch your product page.







    share|improve this answer


























    • Create a whole module just to call echo $product->getData('demo'); in a custom template file? It seems easier to extend catalog_product_view.xml in the Theme - either by re-using the MagentoCatalogBlockProductViewDescription block as described by @Holly, or even by adding your custom custom_tab.phtml to the theme.

      – thaddeusmt
      Oct 9 '17 at 4:07











    • Nicely explain and helpful

      – Nitesh
      Nov 26 '17 at 12:34














    1












    1








    1








    1. First go to the admin panel of your Magento store and then navigate to
      Stores -> Product. Click on Add New Attribute and create new Attribute. (Set Attribute label DEMO and Attribute code demo)


    2. Now go to Stores -> Attribute Set and Add Attribute Set.


    3. Now click on your Attribute Set and dragged unassigned Attribute (which you have created in first step) to Product Details and click Save.


    4. Now go to your product edit page in admin panel and change the attribute name and template name which you have created in first and second step.


    5. In app/code/Test/ProductTabs/etc/module.xml paste this code.
      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
      <module name="Test_ProductTabs" setup_version="1.0.0"></module>
      </config>


    6. In app/code/Test/ProductTabs/registration.php, paste this code.
      <?php
      MagentoFrameworkComponentComponentRegistrar::register(
      MagentoFrameworkComponentComponentRegistrar::MODULE,
      'Test_ProductTabs',
      __DIR__
      );


    7. In app/code/Test/ProductTabs/view/frontend/layout/catalog_product_view.xml, paste this code.
      <?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="MagentoCatalogBlockProductView" name="demo.tab" template="Test_ProductTabs::custom_tab.phtml" group="detailed_info" >
      <arguments>
      <argument translate="true" name="title" xsi:type="string">Custom Tab</argument>
      </arguments>
      </block>
      </referenceBlock>
      </body>
      </page>


    8. Now in app/code/Test/ProductTabs/view/frontend/templates/custom_tab.phtml, paste this code.
      <?php
      $product = $block->getProduct();
      ?>
      <h1 style="color: #00aeed"><?php echo $product->getData('demo'); ?></h1>


    9. Now lauch your product page.







    share|improve this answer
















    1. First go to the admin panel of your Magento store and then navigate to
      Stores -> Product. Click on Add New Attribute and create new Attribute. (Set Attribute label DEMO and Attribute code demo)


    2. Now go to Stores -> Attribute Set and Add Attribute Set.


    3. Now click on your Attribute Set and dragged unassigned Attribute (which you have created in first step) to Product Details and click Save.


    4. Now go to your product edit page in admin panel and change the attribute name and template name which you have created in first and second step.


    5. In app/code/Test/ProductTabs/etc/module.xml paste this code.
      <?xml version="1.0"?>
      <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
      <module name="Test_ProductTabs" setup_version="1.0.0"></module>
      </config>


    6. In app/code/Test/ProductTabs/registration.php, paste this code.
      <?php
      MagentoFrameworkComponentComponentRegistrar::register(
      MagentoFrameworkComponentComponentRegistrar::MODULE,
      'Test_ProductTabs',
      __DIR__
      );


    7. In app/code/Test/ProductTabs/view/frontend/layout/catalog_product_view.xml, paste this code.
      <?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="MagentoCatalogBlockProductView" name="demo.tab" template="Test_ProductTabs::custom_tab.phtml" group="detailed_info" >
      <arguments>
      <argument translate="true" name="title" xsi:type="string">Custom Tab</argument>
      </arguments>
      </block>
      </referenceBlock>
      </body>
      </page>


    8. Now in app/code/Test/ProductTabs/view/frontend/templates/custom_tab.phtml, paste this code.
      <?php
      $product = $block->getProduct();
      ?>
      <h1 style="color: #00aeed"><?php echo $product->getData('demo'); ?></h1>


    9. Now lauch your product page.








    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 18 '16 at 16:13

























    answered Nov 18 '16 at 16:06









    Muneeb SyedMuneeb Syed

    627316




    627316













    • Create a whole module just to call echo $product->getData('demo'); in a custom template file? It seems easier to extend catalog_product_view.xml in the Theme - either by re-using the MagentoCatalogBlockProductViewDescription block as described by @Holly, or even by adding your custom custom_tab.phtml to the theme.

      – thaddeusmt
      Oct 9 '17 at 4:07











    • Nicely explain and helpful

      – Nitesh
      Nov 26 '17 at 12:34



















    • Create a whole module just to call echo $product->getData('demo'); in a custom template file? It seems easier to extend catalog_product_view.xml in the Theme - either by re-using the MagentoCatalogBlockProductViewDescription block as described by @Holly, or even by adding your custom custom_tab.phtml to the theme.

      – thaddeusmt
      Oct 9 '17 at 4:07











    • Nicely explain and helpful

      – Nitesh
      Nov 26 '17 at 12:34

















    Create a whole module just to call echo $product->getData('demo'); in a custom template file? It seems easier to extend catalog_product_view.xml in the Theme - either by re-using the MagentoCatalogBlockProductViewDescription block as described by @Holly, or even by adding your custom custom_tab.phtml to the theme.

    – thaddeusmt
    Oct 9 '17 at 4:07





    Create a whole module just to call echo $product->getData('demo'); in a custom template file? It seems easier to extend catalog_product_view.xml in the Theme - either by re-using the MagentoCatalogBlockProductViewDescription block as described by @Holly, or even by adding your custom custom_tab.phtml to the theme.

    – thaddeusmt
    Oct 9 '17 at 4:07













    Nicely explain and helpful

    – Nitesh
    Nov 26 '17 at 12:34





    Nicely explain and helpful

    – Nitesh
    Nov 26 '17 at 12:34











    1














    I think the better way to do this is to follow the same approach Magento uses to add the description attribute as one of the tabs on the product details page.



    First create your attribute, lets say it's tech_spec and add it to whichever attribute sets you want it to so I can be updated from the Manage Manage Products page.



    Then create/update your appcode[NameSpace][ModuleName]viewfrontendlayoutcatalog_product_view.xml file with:



    <referenceBlock name="product.info.details">
    <block class="MagentoCatalogBlockProductViewDescription" name="product.info.tech.spec" template="product/view/attribute.phtml" group="detailed_info">
    <arguments>
    <argument name="at_call" xsi:type="string">getTechSpec</argument>
    <argument name="at_code" xsi:type="string">tech_spec</argument>
    <argument name="css_class" xsi:type="string">tech-spec</argument>
    <argument name="at_label" xsi:type="string">none</argument>
    <argument name="title" translate="true" xsi:type="string">Technical Specification</argument>
    </arguments>
    </block>
    </referenceBlock>




    Alternatively if you don't want to add an attribute you can add a template instead.



    <referenceBlock name="product.info.details">
    <block class="MagentoCatalogBlockProductView" name="product.info.tech.spec" template="Magento_Catalog::product/view/tech-spec.phtml" group="detailed_info" >
    <arguments>
    <argument translate="true" name="title" xsi:type="string">Technical Specification</argument>
    </arguments>
    </block>
    </referenceBlock>





    share|improve this answer






























      1














      I think the better way to do this is to follow the same approach Magento uses to add the description attribute as one of the tabs on the product details page.



      First create your attribute, lets say it's tech_spec and add it to whichever attribute sets you want it to so I can be updated from the Manage Manage Products page.



      Then create/update your appcode[NameSpace][ModuleName]viewfrontendlayoutcatalog_product_view.xml file with:



      <referenceBlock name="product.info.details">
      <block class="MagentoCatalogBlockProductViewDescription" name="product.info.tech.spec" template="product/view/attribute.phtml" group="detailed_info">
      <arguments>
      <argument name="at_call" xsi:type="string">getTechSpec</argument>
      <argument name="at_code" xsi:type="string">tech_spec</argument>
      <argument name="css_class" xsi:type="string">tech-spec</argument>
      <argument name="at_label" xsi:type="string">none</argument>
      <argument name="title" translate="true" xsi:type="string">Technical Specification</argument>
      </arguments>
      </block>
      </referenceBlock>




      Alternatively if you don't want to add an attribute you can add a template instead.



      <referenceBlock name="product.info.details">
      <block class="MagentoCatalogBlockProductView" name="product.info.tech.spec" template="Magento_Catalog::product/view/tech-spec.phtml" group="detailed_info" >
      <arguments>
      <argument translate="true" name="title" xsi:type="string">Technical Specification</argument>
      </arguments>
      </block>
      </referenceBlock>





      share|improve this answer




























        1












        1








        1







        I think the better way to do this is to follow the same approach Magento uses to add the description attribute as one of the tabs on the product details page.



        First create your attribute, lets say it's tech_spec and add it to whichever attribute sets you want it to so I can be updated from the Manage Manage Products page.



        Then create/update your appcode[NameSpace][ModuleName]viewfrontendlayoutcatalog_product_view.xml file with:



        <referenceBlock name="product.info.details">
        <block class="MagentoCatalogBlockProductViewDescription" name="product.info.tech.spec" template="product/view/attribute.phtml" group="detailed_info">
        <arguments>
        <argument name="at_call" xsi:type="string">getTechSpec</argument>
        <argument name="at_code" xsi:type="string">tech_spec</argument>
        <argument name="css_class" xsi:type="string">tech-spec</argument>
        <argument name="at_label" xsi:type="string">none</argument>
        <argument name="title" translate="true" xsi:type="string">Technical Specification</argument>
        </arguments>
        </block>
        </referenceBlock>




        Alternatively if you don't want to add an attribute you can add a template instead.



        <referenceBlock name="product.info.details">
        <block class="MagentoCatalogBlockProductView" name="product.info.tech.spec" template="Magento_Catalog::product/view/tech-spec.phtml" group="detailed_info" >
        <arguments>
        <argument translate="true" name="title" xsi:type="string">Technical Specification</argument>
        </arguments>
        </block>
        </referenceBlock>





        share|improve this answer















        I think the better way to do this is to follow the same approach Magento uses to add the description attribute as one of the tabs on the product details page.



        First create your attribute, lets say it's tech_spec and add it to whichever attribute sets you want it to so I can be updated from the Manage Manage Products page.



        Then create/update your appcode[NameSpace][ModuleName]viewfrontendlayoutcatalog_product_view.xml file with:



        <referenceBlock name="product.info.details">
        <block class="MagentoCatalogBlockProductViewDescription" name="product.info.tech.spec" template="product/view/attribute.phtml" group="detailed_info">
        <arguments>
        <argument name="at_call" xsi:type="string">getTechSpec</argument>
        <argument name="at_code" xsi:type="string">tech_spec</argument>
        <argument name="css_class" xsi:type="string">tech-spec</argument>
        <argument name="at_label" xsi:type="string">none</argument>
        <argument name="title" translate="true" xsi:type="string">Technical Specification</argument>
        </arguments>
        </block>
        </referenceBlock>




        Alternatively if you don't want to add an attribute you can add a template instead.



        <referenceBlock name="product.info.details">
        <block class="MagentoCatalogBlockProductView" name="product.info.tech.spec" template="Magento_Catalog::product/view/tech-spec.phtml" group="detailed_info" >
        <arguments>
        <argument translate="true" name="title" xsi:type="string">Technical Specification</argument>
        </arguments>
        </block>
        </referenceBlock>






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 38 mins ago

























        answered Apr 7 '17 at 8:52









        HollyHolly

        2,29733377




        2,29733377






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Magento Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f146229%2fmy-custom-product-tab-not-displaying-in-magento-2%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            What other Star Trek series did the main TNG cast show up in?

            Berlina muro

            Berlina aerponto