1

Please look at this screenshot:

enter image description here

Then look at "Mi cuenta" and "Crear una cuenta" links. As you see, those don't have templates defined, and in fact, when I saw the XML for layout, there is no en explicit template definition. so the question is, where is the default template for link defined?

I looked at module-theme/view/frontend/templates/link.phml but it seems it is not used.

Any help please?

1

jstuardo,

I don't speak Spanish, but I think that you are referring to the My Accounts and Create an Account links.

You can remove these from your magento skin/template by editing the layout/customer.xml file.

Additionally, if you wish to remove these from other areas, the layout.xml file can be edited to add "removeLinkByName" entries or by using an entry like this:

<action method="removeLinkByUrl"><url helper="customer/getAccountUrl"/></action>

in the layout.xml file.

Keep in mind, you may have to change the url specified above if your url is different.

| improve this answer | |
  • I don't want to remove the links, but change the HTML. But never mind, I have found that I needed to extend the block because it added the markup I needed to remove (tag UL) – jstuardo Feb 17 '16 at 2:05
0

I have programmed this override:

<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Desytec\Framework\View\Element\Html;

/**
 * Description of MenuUsuario
 *
 * @author Jaime Stuardo
 */
class MenuUsuario extends \Magento\Framework\View\Element\Html\Links {
    /**
     * Render block HTML
     *
     * @return string
     */
    protected function _toHtml()
    {
        if (false != $this->getTemplate()) {
            return parent::_toHtml();
        }

        if ($this->getLinks()) {
            $html = '<div' . ($this->hasCssClass() ? ' class="' . $this->escapeHtml(
                $this->getCssClass()
            ) . '"' : '') . '>';
            foreach ($this->getLinks() as $link) {
                $html .= $this->renderLink($link);
            }
            $html .= '</div>';
        }

        return $html;
    }    
}

And in block definition, I have to set that class instead of default one:

                <container name="menu-top" htmlTag="div" htmlClass="menu-top">
                    <block class="Magento\Framework\View\Element\Template" name="top.search" as="topSearch" template="Magento_Search::form.mini.phtml" />
                    <block class="Desytec\Framework\View\Element\Html\MenuUsuario" name="top.links" template="">
                        <arguments>
                            <argument name="css_class" xsi:type="string">menu-usuario</argument>
                        </arguments>
                    </block>
                    <block class="Desytec\Framework\View\Element\Html\MenuUsuario" name="top.links.responsive" template="">
                        <arguments>
                            <argument name="css_class" xsi:type="string">menu-usuario-responsive</argument>
                        </arguments>
                    </block>                        
                </container>
| improve this answer | |

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.