1

I am using banner extension and the position to display banner on home page is set to Content-Top. The banner appears below category navigation on home page

default.xml for third party banner module

<referenceContainer name="content">
    <block class="Vendor\Module\Block\Bannerslider" name="bannerslider.content.top" before="-">
        <action method="setPosition">
            <argument name="position" xsi:type="string">content-top</argument>
        </action>
    </block>
</referenceContainer>

Now I addded below content in Home Page Content block which will display free shipping image

<p><img src="{{media url="wysiwyg/free-shipping.png"}}" /></p>

On the frontend, home page displays Banner first and then free shipping image. I tried with below code in my custom theme's default.xml

    <referenceContainer name="content">
            <block class="Magento\Cms\Block\Block" name="my-free-shipping-block" before="-">
            <arguments>
                <argument name="block_id" xsi:type="string">my-free-shipping-block</argument>
            </arguments>
        </block>
   </referenceContainer>

where my-free-shipping-block is my block identifier.

  1. How do I show free shipping image first on home page followed by banner ?
  2. Can we use <action method="setPosition"> in our custom theme's default.xml to reorder home page content ?
  • remove before="-" from default.xml from the third party code. You can customize them unless you mess them up. Remember to keep backup. – Purushotam Sangroula Dec 13 '17 at 9:43
  • @Anime, I am making changes in my theme's default.xml and not in third party extension's default.xml. – Slimshadddyyy Dec 13 '17 at 9:45
  • please check the edited answer. – Purushotam Sangroula Dec 13 '17 at 9:55
0

I think you should try creating static block for your placing shipping image before your slider.

You may try following layout in your theme:

    <referenceContainer name="content">
            <block class="Magento\Cms\Block\Block" name="my-free-shipping-block-identifer" before="-">
                <arguments>
                    <argument name="block_id" xsi:type="string">quikrete-free-shipping-block-identifer</argument>
                </arguments>
            </block>
   </referenceContainer>

In above code you must use name="block_id" and use the id of the static block which you will get from backend in place of quikrete-free-shipping-block-identifer.

And edit the default.xml layout of your third party as:

<referenceContainer name="content">
    <block class="Vendor\Module\Block\Bannerslider" name="bannerslider.content.top"  after=''>
    </block>
</referenceContainer>
  • You mean create separate free shipping cms block ? Currently I am adding it in home page block. And in which file do I need to put above snippet code ? – Slimshadddyyy Dec 13 '17 at 9:18
  • try the same file which you used above. i.e. default.xml and create your separate static block, it is short procedure. – Purushotam Sangroula Dec 13 '17 at 9:19
  • ya it does the same. But, make sure that slider from your layout is executed. – Purushotam Sangroula Dec 13 '17 at 9:27

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.