0

I get this error in the system.log:

   [2018-03-13 16:20:04] main.CRITICAL: Invalid template file: 'Magento_Checkout::js/components.phtml' in module: '' block's name: 'checkout_page_head_components' [] []

It's never good to see any error regarding the checkout, has anyone came across it and knows what is the cause and how to resolve it?

Running Magento ver. 2.1.8 and Varnish using Linux.

Also, found this which can be related:

[2018-03-14 09:03:15] main.CRITICAL: Broken reference: No element found with ID 'checkout.header.wrapper'. [] []

Edit:

This is the path to my components.phtml file in my custom theme:

/http/app/design/frontend/Venustheme/cricket_child/Magento_Checkout/templates/js/components.phtml

My layout/default.xml file:

    <referenceBlock name="head.components">
        <block class="Magento\Framework\View\Element\Js\Components" name="checkout_page_head_components" template="Magento_Checkout::js/components.phtml"/>
    </referenceBlock>

My layout/checkout_cart_configure.xml file:

    <referenceBlock name="head.components">
        <block class="Magento\Framework\View\Element\Js\Components" name="checkout_cart_configure_head_components" template="Magento_Checkout::js/components.phtml"/>
    </referenceBlock>
  • Are you using linux? – Adrian Z. Mar 13 '18 at 17:04
  • I am using linux. – Greg Mar 14 '18 at 8:56
  • see updated anwser – Adrian Z. Mar 14 '18 at 10:24
1

That error can appear when the Magento cannot find the template file. Please check if you have any typos in the folder names and check if the folders are the correct case.(Example: On linux "view" and "View" folders are different)

EDIT:

if you want to override the template "components.phtml" you can use the fallback system. You don't need the layouts. Just make sure you have the same paths.

Override templates

The fallback scheme for templates is the following (module context is always known for them):

Current theme templates:

 <theme_dir>/<Namespace>_<Module>/templates

Ancestors themes templates, recursively, until a theme with no ancestor is reached:

<parent_theme_dir>/<Namespace>_<Module>/templates

Module templates:

<module_dir>/view/frontend/templates

So if you need to customize a certain template, you need to create an overriding one with the same name in the ../templates/ directory in the theme module files. Where is the path to the original template.

For example, if you must override the /view/frontend/templates/category/widget/link/link_block.phtml template, the is category/widget/link/

Look here and here.

  • should it be with a capital if I am using linux? – Greg Mar 14 '18 at 9:54
  • it should be "view" with a lower case "v" – Adrian Z. Mar 14 '18 at 9:56
  • can you please share the file path to the components.phtml in your custom module/theme? – Adrian Z. Mar 14 '18 at 9:57
  • This configuration came with the theme I have installed. Also, looking at the file in vendor and the one from the theme, they look exactly the same. Should I still go and overwrite this file or I can remove all the entries of this file in the custom theme? – Greg Mar 14 '18 at 10:43
  • i cannot know for sure if you should remove or keep that file because i don't know the reason/purpose the people who created the theme had when they worked on the custom theme. – Adrian Z. Mar 14 '18 at 11:18

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.