0

I have a really weird issue I hope someone can help with.

It's difficult to even explain because it's so strange, but I will try to be concise.

This is the error message:

1 exception(s):
Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Magento_Theme::html/address.phtml' in module: '' block's name: 'footer.info.address'

Exception #0 (Magento\Framework\Exception\ValidatorException): Invalid template file: 'Magento_Theme::html/address.phtml' in module: '' block's name: 'footer.info.address'
#0 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Element/Template.php(300): Magento\Framework\View\Element\Template->fetchView(false)
#1 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Element/AbstractBlock.php(667): Magento\Framework\View\Element\Template->_toHtml()
#2 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(558): Magento\Framework\View\Element\AbstractBlock->toHtml()
#3 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(534): Magento\Framework\View\Layout->_renderBlock('footer.info.add...')
#4 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('footer.info.add...')
#5 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('footer.info.add...')
#6 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('footer.info.add...', true)
#7 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('footer.info.add...')
#8 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('footer')
#9 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('footer')
#10 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('footer')
#11 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('footer', true)
#12 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('footer')
#13 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('footer-containe...')
#14 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('footer-containe...')
#15 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('footer-containe...')
#16 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('footer-containe...', true)
#17 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('footer-containe...')
#18 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('page.wrapper')
#19 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('page.wrapper')
#20 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('page.wrapper')
#21 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('page.wrapper', true)
#22 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(585): Magento\Framework\View\Layout\Interceptor->renderElement('page.wrapper')
#23 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(536): Magento\Framework\View\Layout->_renderContainer('root')
#24 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(206): Magento\Framework\View\Layout->renderNonCachedElement('root')
#25 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(489): Magento\Framework\View\Layout\Interceptor->renderNonCachedElement('root')
#26 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(193): Magento\Framework\View\Layout->renderElement('root', true)
#27 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Layout.php(954): Magento\Framework\View\Layout\Interceptor->renderElement('root')
#28 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Layout->getOutput()
#29 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Layout\Interceptor->___callParent('getOutput', Array)
#30 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Layout\Interceptor->Magento\Framework\Interception\{closure}()
#31 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Layout/Interceptor.php(494): Magento\Framework\View\Layout\Interceptor->___callPlugins('getOutput', Array, Array)
#32 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Result/Page.php(257): Magento\Framework\View\Layout\Interceptor->getOutput()
#33 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/View/Result/Layout.php(170): Magento\Framework\View\Result\Page->render(Object(Magento\Framework\App\Response\Http\Interceptor))
#34 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/Interception/Interceptor.php(58): Magento\Framework\View\Result\Layout->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#35 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\View\Result\Page\Interceptor->___callParent('renderResult', Array)
#36 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/Interception/Interceptor.php(153): Magento\Framework\View\Result\Page\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Response\Http\Interceptor))
#37 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/View/Result/Page/Interceptor.php(130): Magento\Framework\View\Result\Page\Interceptor->___callPlugins('renderResult', Array, Array)
#38 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/App/Http.php(139): Magento\Framework\View\Result\Page\Interceptor->renderResult(Object(Magento\Framework\App\Response\Http\Interceptor))
#39 /var/www/vhosts/*********/httpdocs/generated/code/Magento/Framework/App/Http/Interceptor.php(24): Magento\Framework\App\Http->launch()
#40 /var/www/vhosts/*********/httpdocs/vendor/magento/framework/App/Bootstrap.php(256): Magento\Framework\App\Http\Interceptor->launch()
#41 /var/www/vhosts/*********/httpdocs/index.php(43): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http\Interceptor))
#42 {main}

This is the footer in default.xml in Theme dir.

    <referenceContainer name="footer-container">
        <container name="footer.panel.wrapper" label="Footer Panel" htmlTag="div" htmlClass="panel wrapper" before="-">
            <container name="footer.panel" label="Footer Panel" htmlTag="div" htmlClass="footer panel" />
        </container>
        <container name="footer.copyright.wrapper" label="Footer Copyright Wrapper" htmlTag="div" htmlClass="copyright wrapper" after="-">
            <container name="footer.copyright" label="Footer Wrapper" htmlTag="div" htmlClass="footer copyright" />
        </container>
    </referenceContainer>
    <referenceContainer name="footer">
        <container name="footer.left" label="Footer Right Column" htmlTag="div" htmlClass="footer left" before="-">
            <block class="Magento\Framework\View\Element\Template" name="footer.info.address" before="-" template="Magento_Theme::html/address.phtml" />
        </container>
        <container name="footer.right" label="Footer Right Column" htmlTag="div" htmlClass="footer right" after="-">
            <block class="Magento\Framework\View\Element\Html\Links" name="footer.account.links" after="-" template="Magento_Theme::html/footer/links.phtml">
                <arguments>
                    <argument name="css_class" xsi:type="string">footer links</argument>
                    <argument name="title" xsi:type="string">Useful Links</argument>
                </arguments>
                <block class="Magento\Customer\Block\Account\Link" name="footer.account.link">
                    <arguments>
                        <argument name="label" xsi:type="string" translate="true">My Account</argument>
                    </arguments>
                </block>
                <block class="Magento\Wishlist\Block\Link" name="footer.wishlist.link" after="footer.account.link" />
                <block class="Magento\Framework\View\Element\Html\Link\Current" name="footer.orders.link" before="footer.wishlist.link">
                    <arguments>
                        <argument name="path" xsi:type="string">sales/order/history</argument>
                        <argument name="label" xsi:type="string" translate="true">My Orders</argument>
                    </arguments>
                </block>
                <block class="Magento\Framework\View\Element\Html\Link\Current" name="footer.address.link" after="footer.wishlist.link">
                    <arguments>
                        <argument name="label" xsi:type="string" translate="true">Address Book</argument>
                        <argument name="path" xsi:type="string">customer/address</argument>
                    </arguments>
                </block>
                <block class="Magento\Customer\Block\Account\RegisterLink" name="footer.register.link" after="footer.address.link">
                    <arguments>
                        <argument name="label" xsi:type="string" translate="true">Create an Account</argument>
                    </arguments>
                </block>
                <block class="Magento\Customer\Block\Account\AuthorizationLink" name="footer.authorization.link" after="footer.register.link" template="account/link/authorization.phtml" />
            </block>
        </container>
    </referenceContainer>
    <referenceBlock name="footer_links">
        <arguments>
            <argument name="title" xsi:type="string">Useful Information</argument>
            <argument name="template" xsi:type="string">Magento_Theme::html/footer/links.phtml</argument>
        </arguments>
    </referenceBlock>

This is the template for footer_links & footer.account.links blocks.

<?php
/**
 * Copyright © 2017 ***, Inc. All rights reserved.
 * @var \Magento\Framework\View\Element\Html\Links $block
 */
?>
<?php if($block->getLinks()): ?>
    <div class="block links"
         data-mage-init='{"collapsible":{
                "openedState": "active"}}'>
        <?php if($block->hasTitle()): ?>
            <div class="title">
                <strong><?php /* @escapeNotVerified */ echo __($block->getTitle()) ?></strong>
        </div>
    <?php endif; ?>
    <div class="content" data-role="content">
        <ul<?php echo $block->hasCssClass() ? ' class="' . $this->escapeHtml($block->getCssClass()) . '"' : '' ?>>
            <?php foreach($block->getLinks() as $link): ?>
                <?php echo $block->renderLink($link); ?>
            <?php endforeach; ?>
        </ul>
    </div>
</div>
<?php endif; ?>

This is the footer.info.address template.

<?php
/**
 * Copyright © 2017 ***, Inc. All rights reserved.
 * @var \Magento\Framework\View\Element\Template $block
 */

$helper = $this->helper('***\Framework\Helper\Data');
?>

<div class="block store-info"
 data-mage-init='{"collapsible":{
    "openedState": "active"}}'>
<div class="title">
    <strong><?php /* @escapeNotVerified */ echo __('Contact Information') ?></strong>
</div>
<div class="content" data-role="content">
    <dl class="address-list">
        <dt class="heading address"><?php /* @escapeNotVerified */ echo __('Address') ?></dt>
        <dd class="content address">
            <address>
                <?php echo $helper->getStoreName(); ?>
                <br />
                <?php echo $helper->getStoreStreetLine1(); ?>,
                <?php echo $helper->getStoreStreetLine2() ? $helper->getStoreStreetLine2() . ',' : ''; ?>
                <br />
                <?php echo $helper->getStoreCity(); ?>,
                <?php echo $helper->getStoreRegionId(); ?>,
                <?php echo $helper->getStorePostcode(); ?>
            </address>
        </dd>
        <dt class="heading telephone"><?php /* @escapeNotVerified */ echo __('Telephone') ?></dt>
        <dd class="content telephone">
            <a class="link telephone" href="tel:<?php echo $helper->getStoreTelephone(); ?>" title="<?php echo __('Why not give us a call on ') . $helper->getStoreTelephone(); ?>">
                <?php echo $helper->getStoreTelephone(); ?>
            </a>
        </dd>
        <dt class="heading email"><?php /* @escapeNotVerified */ echo __('Email') ?></dt>
        <dd class="content email"><a class="link email" href="mailto:<?php echo $helper->getSupportEmail(); ?>" title=""><?php echo $helper->getSupportEmail(); ?></a></dd>
        <dt class="heading opening"><?php /* @escapeNotVerified */ echo __('Working Days/Hours') ?></dt>
        <dd class="content opening"><?php echo $helper->getStoreHours(); ?></dd>
    </dl>
</div>
</div>

I only get the error message on the product view page, everywhere else it's fine. The path can't be wrong because it works on all pages except product view page. Likewise the code inside those templates can't be the issue as it works on all other pages.

If I create those block(s) somewhere else on the page they work fine albeit in the wrong place, so the problem is isolated to the footer. The block also work fine if I've already used the template somewhere else, for example if something in the header used the same template then all of a sudden they start working in the footer.

I've tried literally everything I can think of to try and get around this but nothing viable works.

**** UPDATE ****

A separate issue I am having may have shed some light on this, I wanted to move the reviews on the product page out of the tab and edit the template but for some reason I can't get my review.phtml to take precedence over the core review.phtml, so maybe on my product view page there is an issue where Magento is not looking beyond the core files for templates and that's why it's complaining about my missing template files.

Does anyone know what might cause that?

  • Are u got any solution for this ? – Mahi M Feb 23 '19 at 11:57
0

I stumbled across the problem which appears to be a Magento bug, so posting here in case anyone else has similar problem.

So I had Magento set up to use different themes based on the user agent, it's easier for me to switch between themes quickly on the frontend while testing and developing. But there appears to be a Magento bug on the product view page, but only on certain sections like the footer and the review template where the custom theme isn't applied to these section based on the user agent. So as my custom theme wasn't being applied to these sections and in the footer I was using templates that didn't exist in the core, I was getting the error about invalid templates. Applying my theme fully rather than based on user agent fixed the problem.

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.