2

I added 3 custom tab in product info detail tab page

   <referenceBlock name="product.info.details">
        <block class="Magento\Catalog\Block\Product\View" name="custom1.tab" as="custom1"  template="product/view/custom1.phtml" group="detailed_info" >
            <arguments>
                <argument translate="true" name="title" xsi:type="string">custom1</argument>
            </arguments>
        </block>                  

        <block class="Magento\Catalog\Block\Product\View" name="custom2.tab" as="custom2"  template="product/view/custom2.phtml" group="custom2" >
            <arguments>
                <argument translate="true" name="title" xsi:type="string">custom2</argument>
            </arguments>
        </block>

        <block class="Magento\Catalog\Block\Product\View" name="custom3.tab" as="custom3"  template="product/view/custom3.phtml" group="custom3" >
            <arguments>
                <argument translate="true" name="title" xsi:type="string">custom3</argument>
            </arguments>
        </block>
    </referenceBlock>

and i call .phtml in seperate files. Frontend gets only "custom3" tab which i placed in last line in .xml file.

Please let me know the corrections in this file

1

Please try this way :-

<referenceBlock class="Magento\Catalog\Block\Product\View\Details" name="product.info.details" template="Magento_Catalog::product/view/details.phtml">
    <block class="Magento\Catalog\Block\Product\View" name="custom1.tab" as="custom1"  template="product/view/custom1.phtml" group="detailed_info" >
        <arguments>
            <argument translate="true" name="title" xsi:type="string">custom1</argument>
            <argument name="sort_order" xsi:type="string">10</argument>
        </arguments>
    </block>                  

    <block class="Magento\Catalog\Block\Product\View" name="custom2.tab" as="custom2"  template="product/view/custom2.phtml" group="detailed_info" >
        <arguments>
            <argument translate="true" name="title" xsi:type="string">custom2</argument>
             <argument name="sort_order" xsi:type="string">20</argument>
        </arguments>
    </block>

    <block class="Magento\Catalog\Block\Product\View" name="custom3.tab" as="custom3"  template="product/view/custom3.phtml" group="detailed_info" >
        <arguments>
            <argument translate="true" name="title" xsi:type="string">custom3</argument>
             <argument name="sort_order" xsi:type="string">30</argument>
        </arguments>
    </block>
</referenceBlock>

add

group="detailed_info" in all tab

  • @Bhurio, I tried above the way, but it's too getting same formate – Priya Jun 21 at 11:33
  • 1
    Please add sort_order like this : <argument name="sort_order" xsi:type="string">10</argument> please see my edited answer – Magento_Bhurio Jun 21 at 11:38
  • See my code again. – Magento_Bhurio Jun 21 at 11:40
  • Please let me clarify, in your code 1st line is "<block ...> tag or else <referenceblock ...> tag? – Priya Jun 21 at 11:44
  • Ohh My Bad ..,,, I am sorry .it's referenceblock. – Magento_Bhurio Jun 21 at 11:50

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.