0

I'm trying to add a block to a template built from scratch. Using template-hints I can see that in the footer the following template is rendered

app/design/frontend/Merchant/merchant/Magento_Theme/templates/html/footer-cms.phtml

with some search I fount that the template is configured in app/design/frontend/Merchant/merchant/Magento_Theme/page_layout/1column.xml :

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <!-- REMOVE MAGENTO HEADER & FOOTER -->
    <referenceContainer name="header.container" remove="true"/>
    <referenceContainer name="footer-container" remove="true"/>
    <referenceContainer name="page.top" remove="true" /> 
    <!-- INCLUDES TYPO3 HEADER & FOOTER -->
    <referenceContainer name="page.wrapper">
      <block class="Magento\Framework\View\Element\Template" name="t3header" as="t3header"
        before="main.content"
        template="Magento_Theme::html/header-cms.phtml"/>
      <block class="Magento\Framework\View\Element\Template" name="t3footer" as="t3footer"
        before="before.body.end"
        template="Magento_Theme::html/footer-cms.phtml"/>
    </referenceContainer>
</layout>

as I would like to add a newsletter subscription and terms checkbox in the footer, I am trying to do it in app/code/Myvendor/Newsletter/view/frontend/layout/1column.xml

but it doesn't show up even after clearing the cache and I can't figure out why

<?xml version="1.0"?>
<layout xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_layout.xsd">
    <referenceContainer name="t3footer">
      <block class="Magento\Framework\View\Element\Template" name="wf.newsletter2" as="wf.newsletter2"
        before="-"
        template="Myvendor_Newsletter::newsletterprivacy.phtml"/>
    </referenceContainer>
</layout>

I've also tried to put it in the shop/app/code/Myvendor/Newsletter/view/frontend/layout/default.xml

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
        <referenceBlock name="footer_links">
            <block class="Magento\Framework\View\Element\Template" name="wf.newsletter" as="wf.newsletter"
            before="-"
            template="Myvendor_Newsletter::newsletterprivacy.phtml"/>
        </referenceBlock>
    </body>
</page>

but nothing happened

Can someone help please?

2 Answers 2

0

Make sure your theme is not virtual

Go to theme table into db, and check type of your theme

after change 1 to 0, flush cache and check it.

4
  • Thanks for the reply Sunil. I'm sorry but in my 2.1.5 Magento installation I can't find that table
    – Andy
    Commented May 10, 2017 at 6:55
  • theme table contain from start of magento 2, please check page 2 of that phpmyadmin. Commented May 10, 2017 at 7:14
  • actually i'm not using PhpMyAdmin...anyway this is the result of the command show tables on the db --> link can you see the themes table?
    – Andy
    Commented May 10, 2017 at 7:26
  • seems like lot of table missing please check with core magento2 Commented May 10, 2017 at 7:43
0

t3footer is a block:

<block class="Magento\Framework\View\Element\Template" name="t3footer" as="t3footer"
        before="before.body.end"
        template="Magento_Theme::html/footer-cms.phtml"/>

But you are using referenceContainer:

<referenceContainer name="t3footer">
  ...
</referenceContainer>

So you need to use referenceBlock

<referenceBlock name="t3footer">
  ...
</referenceBlock>

You will need to clear cache if you have it enabled.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.