【问题标题】:How can I remove a link from top.links in Magento Header?如何从 Magento Header 中的 top.links 中删除链接?
【发布时间】:2017-12-22 22:45:55
【问题描述】:

我目前正在使用 Magento 2.2 并安装了一个市场模块,该模块在标题下拉列表中添加了一个“销售”链接。此标题下拉列表调用“top.links”,如下所示:

<div class="dropdown dropdown-toplinks">
                    <button class="dropdown-toggle" type="button" data-toggle="dropdown"><i class="pe-7s-user"></i></button>
                    <div class="dropdown-menu">
                        <?php echo $block->getChildHtml('top.links') ?>
                    </div>
                </div>

在我的 default.xml 文件中,包含的链接是:

<referenceBlock name="advanced-search-link" remove="true"/>
    <referenceBlock name="skip_to_content" remove="true"/>
    <referenceBlock name="authentication-popup" remove="true"/>
    <referenceBlock name="navigation.sections" remove="true"/>

我找不到 top.links 文件,它似乎不存在。有没有办法只删除单数的“销售”链接? (存在的其他链接是我的帐户、登录、我的愿望清单)。

【问题讨论】:

    标签: php xml magento magento2


    【解决方案1】:

    将此添加到您的 default.xml 文件中,

    <referenceBlock name="top.links">
            <referenceBlock name="register-link" remove="true" />           <!--for Create Account Link-->
            <referenceBlock name="authorization-link" remove="true" />      <!--for Sign In Link  -->
            <referenceBlock name="wish-list-link" remove="true" />          <!--for WishList Link-->
            <referenceBlock name="my-account-link" remove="true" />         <!--for My Account Link-->
        </referenceBlock>
    

    【讨论】:

    • 如何重新排列顶部链接下拉列表中的链接?
    猜你喜欢
    • 2012-06-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-23
    • 1970-01-01
    • 1970-01-01
    • 2019-03-03
    相关资源
    最近更新 更多