2

I have changed my page product layout to 2colums-right like this:

<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-right" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">

Now i add my block like this:

 <?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-right" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceContainer name="right">
            <block class="Cmsmart\Promotion\Block\Groupproduct\View" name="promotion_listproduct_view" template="Cmsmart_Promotion::promotion.phtml">       
            </block>
        </referenceContainer>
    </body>
</page>

This block is added ok, but at the end of the page.

My issue is:

How to add this block only on the right side of the page instead of bottom of page?

0

This may help for you. Your catalog_product_view.xml should be like this,

 <?xml version="1.0"?>
 <!--
 /**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="2columns-right" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
    <referenceContainer name="sidebar.additional">
        <block class="Cmsmart\Promotion\Block\Groupproduct\View" name="promotion_listproduct_view"template="Custom_module::promotion.phtml">       
        </block>
    </referenceContainer>
</body>

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.