cancel
Showing results for 
Search instead for 
Did you mean: 

How to add theme header to extension template

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

How to add theme header to extension template

Hi All,

 

I'm trying to add the header and footer to a template in an extension.

 

I've identified the layout file as: magento\app\code\IWD\Opc\view\frontend\layout\onepage_index_index.xml

 

which contains

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
layout="checkout"
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<update handle="checkout_index_index"/>
<head>
<css src="//fonts.googleapis.com/css?family=Open+Sans:400,400italic,700italic,700" src_type="url"/>
<css src="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" src_type="url"/>
</head>
<body>
<referenceBlock name="page.main.title" remove="true"/>
<referenceBlock name="iwd_opc_ga_ab" remove="true"/>
<referenceBlock name="checkout.root">
<action method="setTemplate">
<argument name="template" xsi:type="string">IWD_Opc::onepage.phtml</argument>
</action>
<block class="Magento\GiftMessage\Block\Cart\GiftOptions"
name="checkout.gift_options"
template="IWD_Opc::gift_options.phtml"
cacheable="false">
</block>
</referenceBlock>
<referenceContainer name="before.body.end">
<block class="Magento\Framework\View\Element\Template"
name="iwd.opc.popup"
template="IWD_Opc::popup.phtml">
</block>
</referenceContainer>
</body>
</page>

 

What I did was try to add the following line from: magento\app\design\frontend\Redgiant\xstore\Magento_Theme\page_layout\override\base\1column.xml

 

<block class="Redgiant\Xstore\Block\Template" name="xstore_header" template="Magento_Theme::html/xstore_header.phtml" before="main.content"/>

 

However, that has had no effect. I know editing the file onepage_index_index.xml does work as altering the includes in the head carry through.

 

I think it may be something to do with the class and template references but I'm not sure.

 

Any help would be really appreciated.

 

Many Thanks

1 REPLY 1

Re: How to add theme header to extension template

Hi @ r_s 

Add the follwoing lines in the <body> tag of theme's checkout xml file. 

<body>
    <referenceBlock name="minicart" remove="false" />
    <referenceContainer name="header.panel" remove="false" />
    <referenceBlock name="top.search" remove="false" />
    <referenceBlock name="catalog.compare.link" remove="false" />
    <referenceBlock name="catalog.topnav" remove="false"/>
    <referenceContainer name="footer-container"  remove="false"/>
</body>

I hope it will help you!