Come modificare il menu “Area riservata” del tuo eshop Magento 2
In questo articolo andiamo a vedere come gestire i link di navigazione nel menu della dashboard di magento 2, praticamente in area riservata.
Per prima cosa devi creare un file account_miofile.xml nel tuo tema in:
app/design/frontend/_YOUR_VENDOR_/_YOUR_THEME_/Magento_Customer/layout/account_miofile.xml
Come aggiungere una voce di menu
Per aggiungere l’etichetta “…Label…” nel menu dell’area riservata di Magento 2, che punta al percorso “…path…”, devi modificare il file xml di layout. Tutto quello che devi fare è aggiungere questo codice al nostro file xml di layout:
<referenceBlock name=“customer_account_navigation”>
<block class=“Magento\Framework\View\Element\Html\Link\Current” name=“customer-account-navigation-custom-link” after=“-“ >
<arguments>
<argument name=“label” xsi:type=“string” translate=“true”>…Label…</argument>
<argument name=“path” xsi:type=“string”>… path …</argument>
</arguments>
</block>
</referenceBlock>
Se poi vogliamo posizionare la nuova voce di menu, dobbiamo scrivere:
<move element=“LINK_YOU_WANT_TO_MOVE” destination=“customer_account_navigation” AFTER_OR_BEFORE=“NEW_POSITION” /> <!– eg. “My Wish List” move after “My Orders” –>
<move element=“customer-account-navigation-wish-list-link” destination=“customer_account_navigation” after=“customer-account-navigation-orders-link” />
Abbiamo “spostato” l’elemento dalla sua posizione originale e l’abbiamo riposizionato lì, dicendo allo stesso tempo a M2 di posizionarlo dopo/prima del collegamento che vogliamo.
Come rimuovere la voce di menu
Per semplicità, nell’esempio qui sotto ti mostrerò subito come eliminare uno per uno tutti i link dalla navigazione.
<!– Store credit –>
<referenceBlock name=“customer-account-navigation-customer-balance-link” remove=“true”/>
<!– Downloadable product link –>
<referenceBlock name=“customer-account-navigation-downloadable-products-link” remove=“true”/>
<!– Subscription link –>
<referenceBlock name=“customer-account-navigation-newsletter-subscriptions-link” remove=“true”/>
<!– Billing agreement link –>
<referenceBlock name=“customer-account-navigation-billing-agreements-link” remove=“true”/>
<!– Product review link –>
<referenceBlock name=“customer-account-navigation-product-reviews-link” remove=“true”/>
<!– My credit card link –>
<referenceBlock name=“customer-account-navigation-my-credit-cards-link” remove=“true”/>
<!– Account link –>
<referenceBlock name=“customer-account-navigation-account-link” remove=“true”/>
<!– Account edit link –>
<referenceBlock name=“customer-account-navigation-account-edit-link” remove=“true”/>
<!– Address link –>
<referenceBlock name=“customer-account-navigation-address-link” remove=“true”/>
<!– Orders link –>
<referenceBlock name=“customer-account-navigation-orders-link” remove=“true”/>
<!– Wish list link –>
<referenceBlock name=“customer-account-navigation-wish-list-link” remove=“true”/>
<!– Gift card link –>
<referenceBlock name=“customer-account-navigation-gift-card-link” remove=“true”/>
<!– Gift registry –>
<referenceBlock name=“customer-account-navigation-giftregistry-link” remove=“true”/>
<!– Reward points –>
<referenceBlock name=“customer-account-navigation-reward-link” remove=“true”/>
<!– Order by SKU –>
<referenceBlock name=“customer-account-navigation-checkout-sku-link” remove=“true”/>
Se vuoi migliorare il tuo ecommerce, potete cantattarmi inviando una email all’indirizzo [email protected], o compilando il form contatti di BlogInnovazione.it
Guido Pratt
Magento Specialist
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://www.binance.com/pt-PT/join?ref=T7KCZASX
Your point of view caught my eye and was very interesting. Thanks. I have a question for you. https://www.binance.info/join?ref=YY80CKRN
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me? https://www.binance.com/zh-CN/join?ref=T7KCZASX
Your article helped me a lot, is there any more related content? Thanks! https://www.binance.com/ur/register?ref=GJY4VW8W
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Thanks for sharing. I read many of your blog posts, cool, your blog is very good.
Your article helped me a lot, is there any more related content? Thanks!
Can you be more specific about the content of your article? After reading it, I still have some doubts. Hope you can help me.
Thank you for your sharing. I am worried that I lack creative ideas. It is your article that makes me full of hope. Thank you. But, I have a question, can you help me?
I don’t think the title of your article matches the content lol. Just kidding, mainly because I had some doubts after reading the article.
Your point of view caught my eye and was very interesting. Thanks. I have a question for you.