1

I am trying to change position of attributes.I have created an attribute named custom tab , I am trying to set this attribute in top of product name.But by default this attribute show under More information Tab.

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

enter image description here

3 Answers 3

0

check with this:

    <body>
    <referenceContainer name="content">
        <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.customtab" template="product/view/attribute.phtml" before="product.info.main">
            <arguments>
                <argument name="at_call" xsi:type="string">getCustomTab</argument>
                <argument name="at_code" xsi:type="string">custom_tab</argument>
                <argument name="css_class" xsi:type="string">custom-tab</argument>
                <argument name="at_label" xsi:type="string">Custom Tab</argument>
            </arguments>
        </block>
    </referenceContainer>
</body>
3
  • Well it's awesome @but content is align left side not able to mange with css I want this top of product name
    – sanjay
    Commented Jul 3, 2017 at 12:41
  • Please update answer @ why you delete latest answere
    – sanjay
    Commented Jul 3, 2017 at 12:49
  • Now please check our updated answer Commented Jul 3, 2017 at 12:52
0

you can try this below code.

<referenceContainer name="product.info.main">
    <block class="Magento\Catalog\Block\Product\View" name="custom.tab" as="custom" template="product/view/attributes.phtml" before="-">
       <arguments>
          <argument translate="true" name="title" xsi:type="string">Custom Tab</argument>
       </arguments>
    </block>
    <move element="custom.tab" destination="product.info.main" before="page.main.title" />
</referenceContainer>

*flush/clear cache

3
  • Jothibasu@@can you update this answer with question @my mean can you include your answer in question
    – sanjay
    Commented Jul 3, 2017 at 11:12
  • @sanjay - you can try the updated above code.
    – Jjo
    Commented Jul 3, 2017 at 11:45
  • Jothibasu@@let me know how can use default attribute instead of custom atribute
    – sanjay
    Commented Jul 3, 2017 at 11:55
0

Please try it with another solution:

<referenceContainer name="content">
            <referenceContainer name="product.info.main">
                 <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.customtab" template="product/view/attribute.phtml" before="-">
                    <arguments>
                        <argument name="at_call" xsi:type="string">getCustomTab</argument>
                        <argument name="at_code" xsi:type="string">custom_tab</argument>
                        <argument name="css_class" xsi:type="string">custom_tab</argument>
                        <argument name="at_label" xsi:type="string">custom_tab</argument>
                        <argument name="add_attribute" xsi:type="string">itemprop="custom_tab"</argument>
                    </arguments>
               </block>
            </referenceContainer>

    </referenceContainer>

It will be displayed below the product name enter image description here

2
  • 1
    oK this is awesome@ custom tab need on top of product name
    – sanjay
    Commented Jul 3, 2017 at 12:52
  • any help @regarding this
    – sanjay
    Commented Jul 3, 2017 at 13:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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