i want to change the default value of a field in my admin panel.
an example of app/code/core/mage/page/etc/config.xml
<default>
<design>
<head translate="default_description" module="page">
<default_title>Magento Commerce</default_title>
<default_description>Default Description</default_description>
<default_keywords>Magento, Varien, E-commerce</default_keywords>
<default_robots>*</default_robots>
<default_media_type>text/html</default_media_type>
<default_charset>utf-8</default_charset>
<default_demonotice>1</default_demonotice><!--for example change this default value-->
</head>
<header translate="welcome" module="page">
<logo_src>images/logo.gif</logo_src>
<logo_alt>Magento Commerce</logo_alt>
<welcome>Default welcome msg!</welcome>
</header>
<footer translate="copyright" module="page">
<copyright>© 2008 Magento Demo Store. All Rights Reserved.</copyright>
</footer>
</design>
help please!
Look in system.xml files for the path
and in order to overwrite the value do
<default>
<module><set><field>some_value</field></set></module>
</default>
Related
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!
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:
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
I'm using Magento 1.9, and trying to make a Magento theme.
Here is my app/design/frontend/{MY_PACKAGE}/default/template/layout/page.xml:
<?xml version="1.0"?>
<layout version="1.0">
<default>
<label>All Pages</label>
<reference name="head">
<action method="addCss"><stylesheet>css/base.css</stylesheet></action>
</reference>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
</block>
</default>
</layout>
And this is app/design/frontend/{MY_PACKAGE}/default/template/page/1column.phtml:
<!DOCTYPE html>
<html>
<head>
<?php echo $this->getChildHtml('head'); ?>
</head>
<body>
<?php echo $this->getChildHtml('header'); ?>
<div class="middle">
<div class="col-main"><?php echo $this->getChildHtml('content'); ?></div>
</div>
<?php echo $this->getChildHtml('footer'); ?>
<?php echo $this->getChildHtml('before_body_end'); ?>
</body>
</html>
I can't get the base.css attached to the page; it does not appear in the source code. What did I miss?
p.s. I disabled the cache in Cache Management already; No Design Change applied as well.
UPDATE The page's <head> is rendered as:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Home page</title>
<meta name="description" content="Default Description" />
<meta name="keywords" content="Magento, Varien, E-commerce" />
<meta name="robots" content="NOINDEX,NOFOLLOW" />
<link rel="icon" href="http://www.example.com/dev/skin/frontend/base/default/favicon.ico" type="image/x-icon" />
<link rel="shortcut icon" href="http://www.example.com/dev/skin/frontend/base/default/favicon.ico" type="image/x-icon" />
<!--[if lt IE 7]>
<script type="text/javascript">
//<![CDATA[
var BLANK_URL = 'http://www.example.com/dev/js/blank.html';
var BLANK_IMG = 'http://www.example.com/dev/js/spacer.gif';
//]]>
</script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="http://www.example.com/dev/skin/frontend/base/default/css/styles.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.example.com/dev/skin/frontend/base/default/css/widgets.css" media="all" />
<link rel="stylesheet" type="text/css" href="http://www.example.com/dev/skin/frontend/base/default/css/print.css" media="print" />
<script type="text/javascript" src="http://www.example.com/dev/js/prototype/prototype.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/lib/ccard.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/prototype/validation.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/scriptaculous/builder.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/scriptaculous/effects.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/scriptaculous/dragdrop.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/scriptaculous/controls.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/scriptaculous/slider.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/varien/js.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/varien/form.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/varien/menu.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/mage/translate.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/js/mage/cookies.js"></script>
<!--[if lt IE 8]>
<link rel="stylesheet" type="text/css" href="http://www.example.com/dev/skin/frontend/base/default/css/styles-ie.css" media="all" />
<![endif]-->
<!--[if lt IE 7]>
<script type="text/javascript" src="http://www.example.com/dev/js/lib/ds-sleight.js"></script>
<script type="text/javascript" src="http://www.example.com/dev/skin/frontend/base/default/js/ie6.js"></script>
<![endif]-->
<script type="text/javascript">
//<![CDATA[
Mage.Cookies.path = '/dev';
Mage.Cookies.domain = '.www.example.com';
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
optionalZipCountries = ["HK","IE","MO","PA"];
//]]>
</script>
<script type="text/javascript">//<![CDATA[
var Translator = new Translate([]);
//]]></script></head>
I don't see where they do put the layout in the template folder there but mainly, those information are outdated on your 1.9 version. I can recommend you to read the version you can find here.
But for your specific problem, layout have to be in
app/design/frontend/{MY_PACKAGE}/default/template/layout/
But you also have to understand the fallback mechanism of Magento (further reading here) which basically declare a hierarchy of designs.
This way, if Magento does not find a file in the selected design, it is going to look a it in the next hierarchical design.
As from 1.9 the hierarchy changed.
So before 1.9 the hierarchy was static and was like that
/skin/frontend/{MY_PACKAGE}/{MY_THEME}/
/skin/frontend/{MY_PACKAGE}/default/
/skin/frontend/base/default/
As from 1.9 the fallback is dynamic and can be configured in each theme.
For example, if we take the theme shipped with Magento in app/design/frontend/default/iphone you would find this file : etc/theme.xml which stands
<theme>
<parent>default/default</parent>
</theme>
So if Magento does not find a file in the iphone theme, it is going to look at it in the default theme both under the default package. Since the file etc/theme.xml in the package default and theme default stands it as no parent (<parent/>) the fallback will end there but could have go further if this theme add defined a parent.
That is also why I asked for the rendered <head> of your site because, if the base.css was misplaced, you would have found a call to a base.css but in the wrong location (e.g. a call for http://www.example.com/skin/frontend/base/default/css/base.css)
So, now you know that, you have to know that the layout xml page.xml is responsible for the whole structure of all of your page.
So if you leave your xml like that, you are overriding the page.xml of your Magento.
To do what you want I recommend you to use a file local.xml under app/design/frontend/{MY_PACKAGE}/default/template/layout/ with the exact same code you put in your page.xml and remove that page.xml. That way it should work.
you must add the type , also check if your css its in the correct path
example of page.xml
<default translate="label" module="page">
<label>All Pages</label>
<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
<block type="page/html_head" name="head" as="head">
<action method="addJs"><script>prototype/prototype.js</script></action>
<action method="addJs"><script>lib/ccard.js</script></action>
<action method="addJs"><script>prototype/validation.js</script></action>
<action method="addJs"><script>scriptaculous/builder.js</script></action>
<action method="addJs"><script>scriptaculous/effects.js</script></action>
<action method="addJs"><script>scriptaculous/dragdrop.js</script></action>
<action method="addJs"><script>scriptaculous/controls.js</script></action>
<action method="addJs"><script>scriptaculous/slider.js</script></action>
<action method="addJs"><script>varien/js.js</script></action>
<action method="addJs"><script>varien/form.js</script></action>
<action method="addJs"><script>mage/translate.js</script></action>
<action method="addJs"><script>mage/cookies.js</script></action>
<action method="addJs"><script>prototype/window.js</script></action>
<action method="addItem"><type>js_css</type><name>prototype/windows/themes/default.css</name></action>
<block type="page/js_cookie" name="js_cookies" template="page/js/cookie.phtml"/>
<!-- Remove items which the RWD package is not dependent upon -->
<action method="removeItem"><type>skin_js</type><name>js/ie6.js</name></action>
<!-- Add vendor dependencies -->
<action method="addItem"><type>skin_js</type><name>js/lib/jquery-1.10.2.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/lib/modernizr.custom.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/lib/selectivizr.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/lib/matchMedia.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/lib/matchMedia.addListener.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/lib/enquire.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/app.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/lib/jquery.cycle2.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/lib/jquery.cycle2.swipe.min.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/slideshow.js</name></action>
<action method="addItem"><type>skin_js</type><name>js/lib/imagesloaded.js</name></action>
<action method="addLinkRel"><rel>stylesheet</rel><href>//fonts.googleapis.com/css?family=Raleway:300,400,500,700,600</href></action>
<action method="addItem"><type>skin_js</type><name>js/minicart.js</name></action>
Simple add below code in your 1column.phtml.
app/design/frontend/{MY_PACKAGE}/default/template/page/1column.phtml:
<link rel="stylesheet" type="text/css" href="<php echo $this->getSkinUrl('css/base.css');?>" media="all" />
and add upload base.css to:
/skin/frontend/MY_PACKAGE /default/css
Delete all Cache then refresh
I built a custom currency switcher for my header yesterday, all working well. Today I came to setup the catalog pages and found myself needing to remove the standard currency switcher in the left column, I opened up my local.xml and add a remove to currency. Silly choice perhaps, I managed after fiddleing to get the left.currency to be removed when i suddenly noticed something I had done in one of my files had stopped my header custom currency switcher from displaying.
local.xml
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<!-- Remove callouts and rarely used stuff -->
<remove name="right.poll"/>
<remove name="right.permanent.callout"/>
<remove name="left.permanent.callout"/>
<remove name="paypal.partner.right.logo"/>
<remove name="catalog.compare.list" />
<!-- add the local stylesheet -->
<reference name="head">
<action method="addCss"><stylesheet>css/smoothness/jquery-ui-1.10.1.custom.css</stylesheet></action>
<action method="addJs"><script>ahoy/jquery-1.9.1.js</script></action>
<action method="addJs"><script>ahoy/jquery-ui-1.10.1.custom.js</script></action>
<action method="addJs"><script>ahoy/script.js</script></action>
<action method="addCss"><stylesheet>css/1140.css</stylesheet></action>
<action method="addCss"><stylesheet>css/ahoy.css</stylesheet></action>
</reference>
<reference name="header">
<block type="template/currency" name="custom_currency_selector" template="currency/currency.phtml"/>
</reference>
</default>
<catalog_category_view>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</catalog_category_view>
First part of header.phtml
<div class="header">
<div class="row">
<div class="row">
<div class="sixcol">
<?php echo $this->getChildHtml('topLinks') ?>
<?php echo $this->getChildHtml('custom_currency_selector') ?>
</div>
<div class="sixcol last">
<div class="row">
test/default/template/currency/currency.phtml
<?php if($this->getCurrencyCount() > 1): ?>
<div class="currency-block">
<ul>
<?php foreach ($this->getCurrencies() as $_code => $_name): ?>
<?php $active = ($_code==$this->getCurrentCurrencyCode()) ? "active":""; ?>
<li>
<a class="<?php echo $active; ?>" href="<?php echo $this->getSwitchCurrencyUrl() . "currency/" . $_code; ?>" title="Set <?php echo $_code; ?> as your chosen currency">
<?php echo Mage::app()->getLocale()->currency($_code)->getSymbol(); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
From what I remember this is all I need to create the block, assign its position and call it out. I've been clearing the cache constantly while fiddeling, I reloaded in the currency conversion data, removed and retested the "remove" in local that removed the left bars currency, that one has now come back after i removed the remove for left.currency but the top one never came back.
These are my current files, so no removes at all for currency now, I'm not sure when this vanished but I've only been playing with the left sidebar stuff, after css struggles i tried to remove the currency and as i did not know how to reference it tried killing off all currency i could find and when i twigged i was no longer sure when i removed the top currency.
Try changing type="template/currency" to type="directory/currency"