1

I am trying to customize Magento top header with some custom static block and also want to change and relocate existing link and icon like wish-list. I created static block for top-header social icon and try to add this default.xml file. But unlucky .

    <page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <body>
                <referenceContainer name="header.panel">
            <block class="Magento\Cms\Block\Block" name="header_socail_link"  after="header.panel">
                <arguments>
                    <argument name="block_id" xsi:type="string">header_socail_link</argument>
                </arguments>
            </block> 
        </referenceContainer>
        <referenceBlock name="logo">
            <arguments>
                <argument name="logo_file" xsi:type="string">images/astrokapoor_logo.png</argument>
                <argument name="logo_img_width" xsi:type="number">180</argument>
                <argument name="logo_img_height" xsi:type="number">69</argument>
            </arguments>
        </referenceBlock>
         <referenceContainer name="main.content">
            <block class="Magento\Framework\View\Element\Template" name="skip_to_content.target" before="-" template="Magento_Theme::html/skiptarget.phtml">
                <arguments>
                    <argument name="target_id" xsi:type="string">contentarea</argument>
                </arguments>
            </block>
        </referenceContainer>        
        <referenceContainer name="footer-container">
            <container name="footer" as="footer" label="Page Footer" htmlTag="div" htmlClass="footer content">
                <block class="Magento\Store\Block\Switcher" name="store_switcher" as="store_switcher" template="Magento_Store::switch/stores.phtml"/>
                <block class="Magento\Framework\View\Element\Html\Links" name="footer_links">
                    <arguments>
                        <argument name="css_class" xsi:type="string">footer links</argument>
                    </arguments>
                </block>
                <block class="Magento\Theme\Block\Html\Footer" name="copyright" template="Magento_Theme::html/copyright.phtml"/>
                <block class="Magento\Framework\View\Element\Template" name="report.bugs" template="Magento_Theme::html/bugreport.phtml" />
            </container>
        </referenceContainer>
        <!--<move element="top.links" destination="header-wrapper" after="logo" />!-->
        <move element="wish-list-link" destination="panel.top.links" />
        <referenceBlock name="header" remove="true" />

    </body>
</page>

similarly I want add currency logo on top and wish-list logo after cart item.please see screenshot .its my exact requirement.any help
enter image description here

  • Please share your full code which is in default.xml. – kunj Jun 9 '18 at 3:29
  • kunj@ you there – sanjay yadav Jun 9 '18 at 5:42
  • kun@please check this – sanjay yadav Jun 9 '18 at 5:54
  • You are using header.panel under header.panel. please check your code. – Sukumar Gorai Jun 9 '18 at 7:33
  • Sukumar Gorai @I am new here can you help me regarding This – sanjay yadav Jun 9 '18 at 7:52
1

Try this:

<referenceContainer name="header-wrapper">
        <block class="Magento\Framework\View\Element\Template" before="minicart" name="header.wishlist" template="Magento_Wishlist::link.phtml" />
    </referenceContainer>

Now create new file in your theme like this: /{theme Pcakage}/{theme name}/Magento_Wishlist/templates/link.phtmlAnd add this code in that file:

<div>
    <a href="<?php  echo $this->getUrl('wishlist') ?>" class="action towishlist" data-action="add-to-wishlist"><span><?php echo __('Add to Wish List');?> </span></a>
</div>

Now flush the cache.

  • kunj@I need include wishlist option on header with cart icon, – sanjay yadav Jun 9 '18 at 11:46
  • @sanjayyadav I have updated my code/answer. – kunj Jun 9 '18 at 12:20
  • kunj @it's print a (.) after logo – sanjay yadav Jun 9 '18 at 20:22
  • Please share what have you done. – kunj Jun 10 '18 at 4:26
  • kunj @I follow your instruction but now success – sanjay yadav Jun 10 '18 at 6:09

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.