2

This question already has an answer here:

I want to add a new tab in the product view page similar to Details.

enter image description here

I have tried adding a file 'catalog_product_view.xml' at the location "app/code/Magento/Catalog/view/frontend/layout/" and added the below code

    <page layout="1column" 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\Description" name="product.info.description.extra" template="product/view/attribute.phtml" group="detailed_info">
                    <arguments>
                        <argument name="title" translate="true" xsi:type="string">Custom</argument>
                    </arguments>            
                 </block>
            </referenceBlock>
        </body> 
   </page>

marked as duplicate by Raphael at Digital Pianism, 7ochem, Qaisar Satti, Amit Bera, Fabian Schmengler Aug 26 '16 at 6:51

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

I hope this useful for you..

  1. Create one custom theme Refernece:

    http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html

    https://www.cloudways.com/blog/create-custom-theme-magento-2-part-1/

  2. create catalog_product_view.xml file in your custom theme /app/design/frontend/vendor/themename/Magento_Catalog/layout/catalog_product_view.xml

  3. Then, add below code to catalog_product_view.xml

        <page layout="1column" 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\Attributes" name="product.info.description.extra" template="product/view/attributes.phtml" group="detailed_info">
                        <arguments>
                            <argument name="title" translate="true" xsi:type="string">Custom</argument>
                        </arguments>            
                     </block>
                </referenceBlock>
            </body> 
        </page>
    
    1. Remove var/*

      rm -rf var/*

Now, check Its worked for me..

Note: You can also add this code luma theme /app/design/frontend/Magento/luma/Magento_Catalog/layout/catalog_product_view.xml its work, But this way is not good practice.

0

You have to keep your above xml file at below location inside your custom theme catalog folder.

app/design/frontend/Vendorname/themename/Magento_Catalog/layout

Your xml code is correct given in questions just you have to keep xml file in above mentioned location.

Run command

php bin/magento cache:clean

Remove var folder and check.

  • Hi Rakesh, thanks for your answer. I have tried placing the xml file "catalog_product_view.xml" at the location "app\design\frontend\Magento\luma\Magento_Catalog\layout\" but still it did not work. I have run the command "php bin/magento cache:clean" and removed var folder as suggested. Is there any other thing am I missing? – Ranjith Aug 25 '16 at 9:44
  • You have to create your custom theme and keep inside xml file – Rakesh Jesadiya Aug 25 '16 at 9:45
  • You cant keep inside Magento/luma folder – Rakesh Jesadiya Aug 25 '16 at 9:46
  • But I am still using the same luma theme. Do i need to create a new one set that as the store theme? – Ranjith Aug 25 '16 at 9:49
0

Yes you have to create your own theme and set your theme from admin panel and after set your theme.

Create your theme is used when you have to override your core templates and layout file.

You can get many references for create custom theme in magento 2.

run php bin/magento setup:static-content:deploy command

  • Have you working for you above suggestions? – Rakesh Jesadiya Aug 25 '16 at 12:16

Not the answer you're looking for? Browse other questions tagged or ask your own question.