I am trying to extend the Header (logo, search box and cart), but those files are the different location. I don't know how to adjust those. Could you please suggest me on this.
-
exactly what do you want to do?– Rakesh JesadiyaCommented Dec 8, 2016 at 11:36
-
@Rakesh logo should be left search box should be middle and cart should be right. Is it possible to these codes comes under one file?– BojjaiahCommented Dec 8, 2016 at 11:37
-
This not possible to come these code in one file.– Dipesh RanganiCommented Dec 8, 2016 at 11:59
3 Answers
Change below style:
.header.content {
text-align: center;
}
.logo {
float: none;
display: inline-block;
}
.block-search {
float: none;
display: inline-block;
}
.minicart-wrapper {
float: none;
}
Change below code in Magento_Checkout\layout\default.xml
<block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="top.search" template="cart/minicart.phtml">
The search position is set in the magento-search/view/frontend/layout/default.xml
but the issue is that the minicart is set to have the position after "logo" you need to change this in magento-checkout/view/frontend/layout/default.xml
<block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="logo" template="cart/minicart.phtml">
change to
<block class="Magento\Checkout\Block\Cart\Sidebar" name="minicart" as="minicart" after="top.search" template="cart/minicart.phtml">
and after this style the top search so it shouldn't be with a float: right;
( adapt the style as you like )
Also, it is recomanded to make the changes for the checkout module files in app/design/frontend/YOUR_COMPANY/YOUR_THEME/Magento_Checkout/layout/default.xml
Move search box follow step :
step-1 :- opne Admin
step-2 :- CONTENT > Block > Home Page Block > show - hide edit button click
add css in style tag
.header.content { text-align: center; } .block-search { float: none; display: inline-block; }