3

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.

enter image description here

  • exactly what do you want to do? – Rakesh Jesadiya Dec 8 '16 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? – Bojjaiah Dec 8 '16 at 11:37
  • This not possible to come these code in one file. – Dipesh Rangani Dec 8 '16 at 11:59
3

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">
2

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

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.