0

I'm trying to add an product tab which only functions as a link href predifined in a custom block. No tab content is needed.

I tried the following:

        <referenceBlock name="product.info.details">
            <block class="Customvendor\Custommodule\Block\Product\View\Customtab" name="product.tabs.custom" template="Customvendor_Custommodule::product/view/tab.phtml"/>
        </referenceBlock>

With which tab.phtml contains the clickable button html and the link which it gets from the customtab block.

However the only thing it outputs is a tab without a title/name, and the content of tab.phtml outputted in the content area below the tabs when you click on it.

enter image description here

If anyone could help me further with this it would be much appreciated!

1

Simply create a file catalog_product_view.xml in below location

app/code/NameSpace/ModuleName/view/frontend/layout/

With following contents

<?xml version="1.0"?>
<body>
    <referenceContainer name="product.info.details">
        <block class="NameSpace\ModuleName\Block\Product\View\Extra"
               name="product.view.extra"
               template="NameSpace_Modulename::product/view/extra.phtml"
               after="product.info.overview">
        </block>
    </referenceContainer>
</body>

Now you can make proper use of block and template files in the assigned location as per XML to do as required.

  • Thank you for your answer. However it does not show up, if i add group="detailed_info" to the custom block it does show up, but again without a title/name and with the tab.phtml outputted in the content area below. I added a picture as how it displays at this moment. – ElFietsbel Dec 28 '18 at 10:09

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.