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

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>
  • Well it's awesome @but content is align left side not able to mange with css I want this top of product name – sanjay Jul 3 '17 at 12:41
  • Please update answer @ why you delete latest answere – sanjay Jul 3 '17 at 12:49
  • Now please check our updated answer – Emipro Technologies Pvt. Ltd. Jul 3 '17 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

  • Jothibasu@@can you update this answer with question @my mean can you include your answer in question – sanjay Jul 3 '17 at 11:12
  • @sanjay - you can try the updated above code. – Jjo Jul 3 '17 at 11:45
  • Jothibasu@@let me know how can use default attribute instead of custom atribute – sanjay Jul 3 '17 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

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

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.