How to remove nav-bar from custom magento admin page? - magento

I want to remove navbar from a custom magento admin panel popup. I have already removed header and footer, but can not remove navbar panel.
Please help
<remove name="footer" />
<remove name="header" />
<remove name="top.menu" />
<remove name="top.links" />
<remove name="top.container" />
<reference name="content">
<remove name="nav-bar" />
<remove name="header" />
<block type="core/template" name="xyz" template="abc/test/test.phtml" />
</reference>

Simple way,But I don't know this is better way or not but it's working.
Go to
C:\Xampp\htdocs\your project\app\design\adminhtml\default\default\template\page\menu.phtml
Then comment or delete the menu like as below
<div class="nav-bar">
<!-- menu start -->
<?php //echo $this->getMenuLevel($this->getMenuArray()); ?>
<!-- menu end -->
<a id="page-help-link" href="<?php echo Mage::helper('adminhtml')->getPageHelpUrl() ?>"><?php echo $this->__('Get help for this page') ?></a>
<script type="text/javascript">$('page-help-link').target = 'magento_page_help'</script>
</div>
After changed the code please clear the cache.

Simple way for hide the top menu of admin panel in magento.
Please follow the below steps:
open file adminhtml.xml ;
Location : /app/code/core/Mage/Adminhtml/etc/adminhtml.xml
Note : It is core file so,please override this module(best way).
<!-- Custom work for hide admin menu links -->
<catalog translate="title">
<depends><config>HideMe</config></depends>
</catalog>
<system translate="title">
<depends><config>HideMe</config></depends>
</system>
<sales translate="title">
<depends><config>HideMe</config></depends>
</sales>
<promo translate="title">
<depends><config>HideMe</config></depends>
</promo>
<report translate="title">
<depends><module>HideMe</module></depends>
</report>
<customer translate="title">
<depends><module>HideMe</module></depends>
</customer>
<newsletter translate="title">
<depends><module>HideMe</module></depends>
</newsletter>
<cms translate="title" module="adminhtml">
<depends><module>HideMe</module></depends>
</cms>
<!--Custom work for hide admin menu links end-->
It's working fine.
Thanks
Pradeep kumar

Related

Assign a custom popup.phtml file through a custom extension

Building a custom extension and need to load a new popup.phtml file so we can place our own code into it.
Ive already tried adding it as a package, but I want to avoid this so wondering if theres a way to add this/link to this using an xml layout file for example?
So in short, when a user clicks on the "Track Shipment" link in either the end user account, or the admin clicks the link from Sales > Shipments > View it will load my popup.phtml file and not the default one.
I've managed to solve this so here's how I managed to to it just in case it helps anyone else out :)
First of all in the app/etc/modules you'll need to create a file, lets call it Vendor_Module.xml and in there, we'll put the code;
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Vendor_Module>
<active>true</active>
<codePool>community</codePool>
</Vendor_Module>
</modules>
</config>
Then in app/community/Vendor/Module/etc/config.xml I added the following;
<?xml version="1.0"?>
<config>
<modules>
<Vendor_Module>
<version>1.0.0</version>
</Vendor_Module>
</modules>
<frontend>
<layout>
<updates>
<Vendor_Module_layout module="Vendor_Module">
<file>vendor_module.xml</file>
</Vendor_Module_layout>
</updates>
</layout>
</frontend>
</config>
In app/design/admin/default/default/layout I created vendor_module.xml and added the following code;
<?xml version="1.0"?>
<shipping_tracking_popup translate="label">
<label>Shipment Tracking Popup</label>
<reference name="root">
<action method="setTemplate"><template>page/popuper.phtml</template></action>
</reference>
<reference name="content">
<block type="shipping/tracking_popup" name="shipping.tracking.popup" template="shipping/tracking/popuper.phtml" />
</reference>
</shipping_tracking_popup>
In app/design/frontend/base/default/layout I created another vendor_module.xml file and added the code;
<?xml version="1.0"?>
<layout>
<shipping_tracking_popup>
<reference name="content">
<block type="shipping/tracking_popup" name="shipping.tracking.popup" template="Vendor/shipping/tracking/popup.phtml" />
</reference>
</shipping_tracking_popup>
</layout>
Finally, in app/design/frontend/base/default/template/Vendor/shipping/tracking I created a new file called popup.phtml and then added my own required code that I wanted displayed here. The following code is just example code that will add some text and a close button.
<div class="page-title title-buttons">
<h1><?php echo $this->__('Tracking Information'); ?></h1>
<button class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
</div>
<!-- Add Your Stuff Here -->
<div class="buttons-set">
<button type="button" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Close Window')) ?>" class="button" onclick="window.close(); window.opener.focus();"><span><span><?php echo $this->__('Close Window') ?></span></span></button>
</div>
Thats it, hope it helps!

Magento 1.9 breadcrumbs always empty

I'm working on a magento ecommerce, I'm not the one who configured it or anything, I'm just doing his CSS, however, the site does not display the breadcrumbs.
Inside the "page / html / breadcrumbs.phtml" file I made a var_dump in the $ crumbs variable and it is always empty.
In the XML only in one situation the breadcrumbs is displayed in the frontend, when I enter the code inside the "default" tag if I put this code inside "customer_account_login" nothing will be displayed on the front.
Code of breadcrumbs.phtml:
<?php if($crumbs && is_array($crumbs)): ?>
<div class="breadcrumbs">
<ul>
<?php foreach($crumbs as $_crumbName=>$_crumbInfo): ?>
<li class="<?php echo $_crumbName ?>">
<?php if($_crumbInfo['link']): ?>
<?php echo $this->htmlEscape($_crumbInfo['label']) ?>
<?php elseif($_crumbInfo['last']): ?>
<strong><?php echo $this->htmlEscape($_crumbInfo['label']) ?></strong>
<?php else: ?>
<?php echo $this->htmlEscape($_crumbInfo['label']) ?>
<?php endif; ?>
<?php if(!$_crumbInfo['last']): ?>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
Here part of code of "customer.xml"
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<!-- Mage_Customer -->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
<!-- HERE BREADCRUMBS DISPLAYS ON ALL PAGES THE SAME CONTENT "HOME / MY ACCOUNT" -->
<reference name="breadcrumbs">
<action method="addCrumb">
<crumbName>Home</crumbName>
<crumbInfo><label>Home</label><title>Home</title><link>/</link></crumbInfo>
</action>
<action method="addCrumb">
<crumbName>My Account</crumbName>
<crumbInfo><label>My Account</label><title>My Account</title><link>/customer/account/</link></crumbInfo>
</action>
</reference>
</default>
<!-- Load this update on every page when customer is logged in -->
<customer_logged_in>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action>
</reference>
</customer_logged_in>
<!-- Load this update on every page when customer is logged out -->
<customer_logged_out>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
</reference>
<remove name="reorder"></remove>
</customer_logged_out>
<!-- Layout for customer login page -->
<customer_account_login translate="label">
<label>Customer Account Login Form</label>
<!-- Mage_Customer -->
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml" />
</reference>
</customer_account_login>
If I move the breadcrumbs code from "< default >" to the "< customer_account_login translate="label" >" for example, all screens returns the breadcrumbs as null.
I have no idea what's going on. I just wish all the screens had their breadcrumbs being displayed.
Check that breadcrumbs are actually enabled in the back end admin panel like below.

Creating custom header extending Magento blank in Magento 2

I am trying to create a theme with Magento Blank as parent in Magento 2 but I can't figure it out how to change the header with a custom one.
I first remove header.container from magento blank and create my container but it is created inside page-wrapper between main-content and footer and I can't make it go before main-content.
This is my layout.xml:
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<body>
<referenceBlock name="register-link" remove="true" />
<referenceBlock name="authorization-link" remove="true" />
<referenceBlock name="wish-list-link" remove="true" />
<referenceBlock name="my-account-link" remove="true" />
<referenceBlock name="top.links" remove="true" />
<referenceBlock name="header.panel.wrapper" remove="true" />
<referenceBlock name="header.container" remove="true" />
<referenceContainer name="page.wrapper">
<container name="custom.header" htmlClass="headerSection" htmlTag="div">
<block class="Magento\Framework\View\Element\Template" name="navigation.sections" before="-" template="Magento_Theme::html/sections.phtml">
</block>
</container>
</referenceContainer>
</body>
</page>
And this is how it looks the HTML:

magento - adding a block using local.xml

if I have a template in
app\design\frontend\base\default\template\dir\template.phtml
that look like this
<div class='block block-list'>
<div class='block-title'><strong><span>Some Block</span></strong></div>
<div class='block-content'>
<?php echo "my content"; ?>
</div>
</div>
How can I show it on a catalog page using local.xml? Shouldn't this code work?
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="right">
<block type="core/template"
name="somename"
template="dir/template.phtml" />
</reference>
</default>
</layout>
I think you can not have custom layout handle<catalog_category_default translate="label"> inside default layout handle<default>
Correct me if I am wrong.
You have to use template reference name before that reference tag.
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<catalog_category_default translate="label">
<reference name="right">
<block type="core/template"
name="somename"
template="dir/template.phtml" />
</reference>
</catalog_category_default>
</default>
</layout>

Remove navigation links from My Account

I am running Mage 1.5.0.1 and I am trying to remove the navigation links from the My Account section.
My local.xml has the following which works fine:
<customer_account>
<reference name="root">
<action method="setTemplate"><template>page/staticpage.phtml</template></action>
</reference>
<reference name="left">
<remove name="cart_sidebar" />
<remove name="catalog.compare.sidebar" />
</reference>
</customer_account>
When I try to add the following code the system throws and error:
<reference name="customer_account_navigation">
<action method="removeLinkByName"><name>recurring_profiles</name></action>
<action method="removeLinkByName"><name>billing_agreements</name></action>
</reference>
Error
Invalid method Mage_Customer_Block_Account_Navigation::removeLinkByName
I saw this function in 1.4, is it not supported anymore or am I doing something wrong?
I had a similar problem, and I didn't want to comment out addLink node because we want to implement our changes in local.xml only. Ended up writing a small module to do it:
app\etc\modules\Stackoverflow_Customerlinks.xml:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Stackoverflow_Customerlinks>
<active>true</active>
<codePool>local</codePool>
</Stackoverflow_Customerlinks>
</modules>
</config>
app\code\local\Stackoverflow\Customerlinks\Block\Account\Navigation.php:
<?php
class Stackoverflow_Customerlinks_Block_Account_Navigation extends Mage_Customer_Block_Account_Navigation {
public function removeLinkByName($name) {
unset($this->_links[$name]);
}
}
app\code\local\Stackoverflow\Customerlinks\etc\config.xml:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<global>
<blocks>
<customer>
<rewrite>
<account_navigation>Stackoverflow_Customerlinks_Block_Account_Navigation</account_navigation>
</rewrite>
</customer>
</blocks>
</global>
</config>
After that, you can simply make the changes through local.xml:
<customer_account>
<reference name="customer_account_navigation">
<action method="removeLinkByName"><name>recurring_profiles</name></action>
<action method="removeLinkByName"><name>billing_agreements</name></action>
</reference>
</customer_account>
Have fun :)
By default, we don't have such method as "removeLink". Therefore, the trick is to remove the whole block using "unsetChild" approach and add the needed links block back with our own links added to it in local.xml
<customer_account translate="label">
<reference name="left">
<!--Unset the whole block then add back later-->
<action method="unsetChild"><name>customer_account_navigation</name></action>
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
<action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
<action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
<action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action>
<action method="addLink" translate="label" module="review"><name>reviews</name><path>review/customer</path><label>My Product Reviews</label></action>
<action method="addLink" translate="label" module="wishlist" ifconfig="wishlist/general/active"><name>wishlist</name><path>wishlist/</path><label>My Favorite</label></action>
<action method="addLink" translate="label" module="newsletter"><name>newsletter</name><path>newsletter/manage/</path><label>Newsletter Subscriptions</label></action>
</block>
<remove name="catalog.compare.sidebar"/>
</reference>
</customer_account>
Just to inform you guys about all the links in the navigation menu.
To remove all links in local.xml:
<?xml version="1.0"?>
<layout version="0.1.0">
<customer_account>
<reference name="customer_account_navigation" >
<!-- remove the link using your custom method -->
<action method="removeLinkByName"><name>recurring_profiles</name></action>
<action method="removeLinkByName"><name>billing_agreements</name></action>
<action method="removeLinkByName"><name>reviews</name></action>
<action method="removeLinkByName"><name>downloadable_products</name></action>
<action method="removeLinkByName"><name>OAuth Customer Tokens</name></action>
<action method="removeLinkByName"><name>account</name></action>
<action method="removeLinkByName"><name>account_edit</name></action>
<action method="removeLinkByName"><name>address_book</name></action>
<action method="removeLinkByName"><name>orders</name></action>
<action method="removeLinkByName"><name>tags</name></action>
<action method="removeLinkByName"><name>wishlist</name></action>
<action method="removeLinkByName"><name>newsletter</name></action>
</reference>
</customer_account>
</layout>
Thanks for your answer Daniel Sloof
You can use that:
<customer_account>
<action method="unsetChild"><name>customer_account_navigation</name></action>
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
<action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
...
</block>
</customer_account>
Rewriting is not solution...
I just refactored account dashboard links and removed CSS nth-child selectors as I had before and instead changed app/design/frontend/default/your_theme/template/customer/account/navigation.phtml to this
<div class="block block-account">
<div class="block-title">
<strong><span><?php echo $this->__('My Account'); ?></span></strong>
</div>
<div class="block-content">
<ul>
<?php $_links = $this->getLinks(); ?>
<?php $_index = 1; ?>
<?php $_count = count($_links);
unset($_links['recurring_profiles']);
unset($_links['billing_agreements']);
unset($_links['reviews']);
unset($_links['tags']);
unset($_links['OAuth Customer Tokens']);
unset($_links['downloadable_products']);
?>
<?php foreach ($_links as $_link): ?>
<?php $_last = ($_index++ >= $_count); ?>
<?php if ($this->isActive($_link)): ?>
<li class="current<?php echo ($_last ? ' last' : '') ?>"><strong><?php echo $_link->getLabel() ?></strong></li>
<?php else: ?>
<li<?php echo ($_last ? ' class="last"' : '') ?>><?php echo $_link->getLabel() ?></li>
<?php endif; ?>
<?php endforeach; ?>
</ul>
</div>
basically unset any unwanted links.
There are other various xml file that refer to <reference name="customer_account_navigation"> where you can copy the xml file to your layout directory and comment out the addLink node other than that, I see a removeLinkByUrl that you might try instead.
You can also, override declaration by empty link - without define 'path' and 'label', direcly in local.xml:
<customer_account>
<reference name="customer_account_navigation">
<action method="addLink"><name>tags</name></action>
<action method="addLink"><name>newsletter</name></action>
</reference>
</customer_account>
Go to app/design/frontend/YourPackageName/YourThemeName/layout/, create a sales/ directory if there isn't one, and create an empty file or directory named billing_agreement.xml and recurring_profile.xml.
Cleanest method ever, no custom functions, no CSS hacking, no logic in template files.
This completely hides the Billing Agreements and Recurring Profiles features from the user.
This module makes functionality ordering or show the links of my own, does not make for layout and phtml overwrites the block and makes all the logic there.
http://www.magentocommerce.com/magento-connect/customer-navigation.html
The cleanest solution would be to make an overwrite of the box and add a method to remove links from layout.
My Account Navigation links comes from customer.xml file.
<block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
<action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
<action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
<action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
</block>
My apperoach is to bring power of css and avoid hevy code modifications.
E.G.
/* CUSTOMER ACCOUNT LEFT NAV DISABLER */
.block-content li:nth-child(4),
.block-content li:nth-child(5),
.block-content li:nth-child(6),
.block-content li:nth-child(8){display: none;}
Obviously change selectors to your themes customer navigation li, and use li:nth-child() sudo with number between parenthesis which you want to remove.
Use comments in customer.xml as well just in case u don't forget what you did 6 month down the line.

Resources