1

I've been looking for positioning a block (it's a banner image). In the product details section, my layout is set in '3columns', I want to insert it in top of the three columns, inside of the container div (its class is "columns")

I've created a static block, then a widget to positioning; and the positions available aren't the one i'm looking for.

If you want to know, I would like to change the structure of the 3 columns + my block

Thanks!

1

You can select "Before Main Columns" container and render your CMS block before div.columns if you are using widget to add it to the product details page.

enter image description here

Containers are defined in Magento/Theme/view/base/page_layout/empty.xml:

<container name="columns.top" label="Before Main Columns"/>
<container name="columns" htmlTag="div" htmlClass="columns">

The missing label of columns container excludes it from the dropdown with containers in the admin area. This is some kind of magento core team restrictions I think to place CMS blocks in any containers (there is a lot of structural blocks).

Anyway if you want to place that CMS block inside the .columns div you can create layout xml file in your theme and add the block:

Path: app/design/frontend/Vendor/theme/Magento_Catalog/layout/catalog_product_view.xml

<referenceContainer name="columns">
    <block class="Magento\Cms\Block\Block" name="banner" before="-">
        <arguments>
            <argument name="block_id" xsi:type="string">banner</argument>
        </arguments>
    </block>
</referenceContainer>
  • thanks a lot!, I will try creating a layout, it seems what I was looking for – Moni Jul 18 '16 at 16:20
  • If you have theme then this should work on 100%. Please try it and then vote if it works. :) – Miroslav Petroff Jul 18 '16 at 17:11

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.