0

I want to move the product description to appear right after the short description on our Magento 2.1 product detail page.

However My issue is I am not sure what the element name is for the short description and long description fields are.

I know I need something like

<move element="product_info_long_description" destination="product.info.main" after="product.info.short_description"/>

Here is my page layout xml I need to alter

<?xml version="1.0"?>
 <!--
   /**
    * Copyright © 2016 SW-THEMES. All rights reserved.
    * See COPYING.txt for license details.
    */
 -->
 <page layout="2columns-right" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
    <!--<script src="Magento_Catalog::js/jquery.zoom.min.js"/>-->
</head>
<body>
    <referenceContainer name="sidebar.additional">
        <block class="Smartwave\Porto\Block\Template" name="product_view_custom_block" before="-" template="Magento_Catalog::product/view/custom_block.phtml"/>
    </referenceContainer>
    <move element="product.info.stock.sku" destination="product.info.price" after="product.price.final"/>
    <move element="product.info.review" destination="product.info.main" before="product.info.price"/>
    <move element="catalog.product.related" destination="sidebar.additional" after="product_view_custom_block"/>
    <move element="product.info.overview" destination="product.info.main" after="product.info.review"/>
    <referenceContainer name="after.body.start">
        <block class="Magento\Catalog\Block\Product\View" name="product_custom" template="Magento_Catalog::product/view/product_custom.phtml" before="-"/>
        <block class="Smartwave\Porto\Block\Template" name="product_view_config" after="-" template="Magento_Catalog::product/view/config.phtml"/>
    </referenceContainer>
    <referenceContainer name="columns.top">
        <block class="Magento\Catalog\Block\Product\View" name="prev_next_products" template="Magento_Catalog::product/view/prev_next.phtml" before="-"/>
    </referenceContainer>
    <move element="prev_next_products" destination="product.info.main" before="-"/>
    <move element="page.main.title" destination="product.info.main" before="-"/>
    <referenceContainer name="product.info.social">
        <block class="Smartwave\Porto\Block\Template" name="product_view_addthis_links" after="-" template="Magento_Catalog::product/view/addthis.phtml"/>
    </referenceContainer>
    <referenceContainer name="content">
        <block class="Smartwave\Porto\Block\RickSnippet" name="rich_snippet" template="Magento_Catalog::product/view/rich_snippet.phtml" before="-"/>
        <block class="Smartwave\Porto\Block\Template" name="product_view_main_custom_block" before="product.info.main" template="Magento_Catalog::product/view/main_custom_block.phtml"/>
        <block class="Smartwave\Porto\Block\Template" name="product_view_main_custom_block2" after="-" template="Magento_Catalog::product/view/main_custom_block2.phtml"/>
    </referenceContainer>
    <move element="product_view_main_custom_block2" destination="product.info.main" after="product.info.overview"/>
    <var name="gallery">
       <var name="allowfullscreen">false</var>
    </var>    

</body>

3
  • as I know in Magento 2 product description appears in tab.do you want remove it from that tab and wants get below short description.Right ?
    – Pawan
    Jul 28 '17 at 17:00
  • yes that is what I want to do.
    – Jayreis
    Jul 28 '17 at 17:37
  • Have you got solution ?
    – Pawan
    Jul 29 '17 at 16:45
0

Give this a try:

Before changes:Before changes

For remove Description Tab and adding description below short description use below code in catalog_product_view.xml in your theme with location app/design/frontend/Namespace/Theme/Magento_Catalog/layout

<referenceContainer name="product.info.main">
   <referenceBlock name="product.info.description" remove="true"/>
   <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description.custom" template="product/view/attribute.phtml" group="detailed_info">
        <arguments>
            <argument name="at_call" xsi:type="string">getDescription</argument>
            <argument name="at_code" xsi:type="string">description</argument>
            <argument name="css_class" xsi:type="string">description</argument>
            <argument name="at_label" xsi:type="string">none</argument>
            <argument name="title" translate="true" xsi:type="string">Details</argument>
        </arguments>
    </block>
</referenceContainer>

After changes: After Making changes

Edit: I have correct the file path and adding whole catalog_product_view.xml

<?xml version="1.0"?>
<page layout="1column" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>

   <referenceContainer name="product.info.main">
       <referenceBlock name="product.info.description" remove="true"/>
       <block class="Magento\Catalog\Block\Product\View\Description" name="product.info.description.custom" template="product/view/attribute.phtml" group="detailed_info">
                <arguments>
                    <argument name="at_call" xsi:type="string">getDescription</argument>
                    <argument name="at_code" xsi:type="string">description</argument>
                    <argument name="css_class" xsi:type="string">description</argument>
                    <argument name="at_label" xsi:type="string">none</argument>
                    <argument name="title" translate="true" xsi:type="string">Details</argument>
                </arguments>
            </block>
    </referenceContainer> 
</body>

2
  • this does not help as if I just copy and paste the above code into our Magento_Catalog/layout/catalog_product_view.xml file and clear cache, etc it does not do anything. ? Could you use the file I posted in my origional post and let me know what to chat.
    – Jayreis
    Jul 31 '17 at 14:42
  • @user1739740, it is working fine and for change layout of product view page you need to edit above file i.e catalog_product_view.xml. just remove default.xml from folder and try the code
    – Pawan
    Jul 31 '17 at 17:44

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.