3

I use Luma theme enter image description hereand I tried to figure out and manage it from default.xml but it didn't work. I need to change the name od tabs and add new links in tab. Where I can find it inside file?

3 Answers 3

2

Add below code in your default.xml file

Path :

app/design/frontend/YourTheme/Package/Magento_Theme/layout/default.xml

<referenceBlock name="store.menu" >
    <arguments>
        <argument name="title" translate="true" xsi:type="string">Change Here</argument>
        </arguments>
</referenceBlock>
1
0

enter image description here

I want to move this in Konto tab.

and I think this is their part in .xml

            <block class="Magento\Framework\View\Element\Text" name="store.links" group="navigation-sections">
                <arguments>
                    <argument name="title" translate="true" xsi:type="string">Account</argument>
                    <argument name="use_force" xsi:type="boolean">true</argument>
                    <argument name="text" xsi:type="string"><![CDATA[<!-- Account links -->]]></argument>
                </arguments>
            </block>
            <block class="Magento\Framework\View\Element\Template" name="store.settings" group="navigation-sections" template="Magento_Theme::html/container.phtml">
                <arguments>
                    <argument name="title" translate="true" xsi:type="string">Settings</argument>
                </arguments>
                <block class="Magento\Store\Block\Switcher" name="store.settings.language" template="switch/languages.phtml">
                    <arguments>
                        <argument name="id_modifier" xsi:type="string">nav</argument>
                    </arguments>
                </block>
                <block class="Magento\Directory\Block\Currency" name="store.settings.currency" template="currency.phtml">
                    <arguments>
                        <argument name="id_modifier" xsi:type="string">nav</argument>
                    </arguments>
                </block>
            </block>

according to inspect element that Konto is in store.links and Service in store.settings

1
  • try with update code of xml file Oct 13, 2016 at 9:43
0

You have to override file into your theme,

Change if($label == 'Menu') $label = 'custom name'; with your menu name.

magento 2/app/design/frontend/Vendor/themename/Magento_Theme/templates/html/sections.phtml

Keep below code inside above file,

<?php

/**
*  General template for displaying group of blocks devided into sections
*/

$group = $block->getGroupName();
$groupCss = $block->getGroupCss();
$groupBehavior = $block->getGroupBehaviour() ? $block->getGroupBehaviour() : '{"tabs":{"openedState":"active"}}';
?>
<?php if ($detailedInfoGroup = $block->getGroupChildNames($group, 'getChildHtml')):?>
    <div class="sections <?php /* @escapeNotVerified */ echo $groupCss ?>">
        <?php $layout = $block->getLayout(); ?>
        <div class="section-items <?php /* @escapeNotVerified */ echo $groupCss ?>-items" data-mage-init='<?php /* @escapeNotVerified */ echo $groupBehavior ?>'>
            <?php foreach ($detailedInfoGroup as $name):?>
                <?php
                    $html = $layout->renderElement($name);
                    if (!trim($html) && ($block->getUseForce() != true)) {
                        continue;
                    }
                    $alias = $layout->getElementAlias($name);
                    $label = $block->getChildData($alias, 'title');


                    if($label == 'Menu') $label = 'custom name';
                ?>
                <div class="section-item-title <?php /* @escapeNotVerified */ echo $groupCss ?>-item-title" data-role="collapsible">
                    <a class="<?php /* @escapeNotVerified */ echo $groupCss ?>-item-switch" data-toggle="switch" href="#<?php /* @escapeNotVerified */ echo $alias; ?>"><?php /* @escapeNotVerified */ echo $label; ?></a>
                </div>
                <div class="section-item-content <?php /* @escapeNotVerified */ echo $groupCss ?>-item-content" id="<?php /* @escapeNotVerified */ echo $alias; ?>" data-role="content"><?php /* @escapeNotVerified */ echo $html; ?></div>
            <?php endforeach;?>
        </div>
    </div>
<?php endif; ?>

For links you can try with your theme default.xml file,

keep below code,

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page layout="3columns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
 <referenceBlock name="navigation.sections">
         <block class="Magento\Framework\View\Element\Template" name="store.menu" group="navigation-sections" template="Magento_Theme::html/container.phtml">
            <arguments>
                <argument name="title" translate="true" xsi:type="string">Menu</argument>
            </arguments>
            <block class="Magento\Theme\Block\Html\Topmenu" name="catalog.topnav" template="html/topmenu.phtml" ttl="3600" before="-"/>
        </block>
        <block class="Magento\Framework\View\Element\Text" name="store.links" group="navigation-sections">
            <arguments>
                <argument name="title" translate="true" xsi:type="string">Account</argument>
                <argument name="use_force" xsi:type="boolean">true</argument>
                <argument name="text" xsi:type="string"><![CDATA[<!-- Account links -->]]></argument>
            </arguments>
             <arguments>
                <argument name="title" translate="true" xsi:type="string">Settings</argument>
            </arguments>
            <block class="Magento\Store\Block\Switcher" name="store.settings.language" template="switch/languages.phtml">
                <arguments>
                    <argument name="id_modifier" xsi:type="string">nav</argument>
                </arguments>
            </block>
        </block>
</referenceBlock>
</body>
</page>
5
  • Thank you. But how can I add new links in tab? Whatever I change in default.xml nothing's changed on the screen.
    – codeIT
    Oct 13, 2016 at 8:08
  • which place are you want to add links? Oct 13, 2016 at 8:43
  • I have a link in one tab that I want to move to another. But I can't access to them. I found in default.xml where they should be by their id.
    – codeIT
    Oct 13, 2016 at 8:52
  • please show with screenshot your give your link description Oct 13, 2016 at 8:53
  • I posted it above.
    – codeIT
    Oct 13, 2016 at 9:30

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.