3

I want to move search textbox and cart image to left side of top links. enter image description here

For this i have created theme puma and specified parent as luma. After customer login top links moved to dropdown. Now I want to move search textbox and cart image to left side of top links.

I have identified search textbox is coming from vendor/magento/module-search/view/frontend/templates/form.mini.phtml, and its layout default.xml in vendor/magento/module-search/ and its block name as topSearch.

so i have created Module_Search folder -> layout folder and default.xml file in app/design/frontend/puma.

And i wrote <move element="topSearch" destination="top.links" before="customer"/> but its not working.

Assume i was perfect till identifying block but i could not identify destination value, I have seen Magento_Theme->page_layout->1column.xml but could not identify.

0

3 Answers 3

6

I have reviwed your request Please follow below steps.

You need to create 'Search Module' folder under your puma theme and copy default.xml into layout

(e.g) puma > Magento_CatalogSearch > layout > default.xml

To move top.search you need to write following code in your (puma > Magento_CatalogSearch > layout > default.xml)

<move element="top.search" destination="header.panel" before="header.links"/>

To move minicart you need to write following code in your (puma > Magento_Checkout > layout > default.xml)

where header.panel is <referenceContainer> of header.links please review luma > Magento_Theme > layout > default.xml

<referenceContainer name="header.panel">
        <block class="Magento\Framework\View\Element\Html\Links" name="header.links">
            <arguments>
                <argument name="css_class" xsi:type="string">header links</argument>
            </arguments>
        </block>
</referenceContainer>

or you can also write directly into (puma > Magento_Theme > layout > default.xml)

<move element="top.search" destination="header.panel" before="header.links"/>
<move element="minicart" destination="header.panel" after="top.search"/>

please let me know if it's not working.

1
  • after header links minicart and in last search textbox was placed, but i want textbox before minicart for that i used <move element="top.search" destination="header.panel" before="-"/>, but its not working Commented Dec 17, 2015 at 10:02
2

Extending Satish's answer to address prasad's last comment:

after header links minicart and in last search textbox was placed, but i want textbox before minicart for that i used , but its not working

Try:

move element="minicart" destination="top.links" after="-" />

See: Magento 2: Issue while add custom top links in header

0
<referenceBlock name="top.links">
            <block class="Magento\Customer\Block\Account\Link" name="my-account-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">My Account</argument>
                    <argument name="sortOrder" xsi:type="number">110</argument>
                </arguments>
            </block>
            <block class="Magento\Customer\Block\Account\RegisterLink" name="register-link">
                <arguments>
                    <argument name="label" xsi:type="string" translate="true">Create an Account</argument>
                </arguments>
            </block>
            <block class="Magento\Customer\Block\Account\AuthorizationLink" name="authorization-link"
                   template="Magento_Customer::account/link/authorization.phtml"/>
        </referenceBlock>

Need to work on Block folder also which is extends from \Magento\Framework\View\Element\Html\Link implements SortLinkInterface

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.