4

I need to remove the ttl attribute value from catalog.topnav block in default.xml file. I have overrided the file in custom path as follows:

Magento_Theme/layout/default.xml

<referenceBlock name="catalog.topnav">
   <attribute name="ttl" value="" />
</referenceBlock>

Original block is as follows:

 <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="Magento_Theme::html/topmenu.phtml" ttl="3600" before="-">
1
  • You can try unset Commented Sep 6, 2018 at 5:35

2 Answers 2

2

I have overrided the file in custom path as follows:

Magento_Theme/layout/default.xml

<referenceBlock name="catalog.topnav" remove="true"/>
<referenceBlock name="store.menu">
    <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav.without.ttl" template="Magento_Theme::html/topmenu.phtml" before="-"/>
</referenceBlock>

and override also the

Magento_Theme/layout/print.xml

<referenceBlock name="catalog.topnav.without.ttl" remove="true"/>

maybe it works for you too.

1

late but it works for me

   <referenceBlock name="catalog.topnav">
        <action method="unsetData">
            <argument name="key" xsi:type="string">ttl</argument>
        </action>
    </referenceBlock>

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.