How to find out which layout handles to be changed?
How do I find out which handles should I use when I want to customize a certain page?
For example, by searching online, I found out that checkout_onepage_index
is the handle to modify the Checkout page. I don't know about this magic, but somehow somebody just know it and I want to know how the learn this magic.
<?xml version="1.0"?>
<layout>
<checkout_onepage_index>
<reference name="head"></reference>
</checkout_onepage_index>
</layout>
How do I know what handles if let say I want to modify the success page instead? or the frontend order detail page? etc...?
magento-1.9 layout
add a comment |
How do I find out which handles should I use when I want to customize a certain page?
For example, by searching online, I found out that checkout_onepage_index
is the handle to modify the Checkout page. I don't know about this magic, but somehow somebody just know it and I want to know how the learn this magic.
<?xml version="1.0"?>
<layout>
<checkout_onepage_index>
<reference name="head"></reference>
</checkout_onepage_index>
</layout>
How do I know what handles if let say I want to modify the success page instead? or the frontend order detail page? etc...?
magento-1.9 layout
add a comment |
How do I find out which handles should I use when I want to customize a certain page?
For example, by searching online, I found out that checkout_onepage_index
is the handle to modify the Checkout page. I don't know about this magic, but somehow somebody just know it and I want to know how the learn this magic.
<?xml version="1.0"?>
<layout>
<checkout_onepage_index>
<reference name="head"></reference>
</checkout_onepage_index>
</layout>
How do I know what handles if let say I want to modify the success page instead? or the frontend order detail page? etc...?
magento-1.9 layout
How do I find out which handles should I use when I want to customize a certain page?
For example, by searching online, I found out that checkout_onepage_index
is the handle to modify the Checkout page. I don't know about this magic, but somehow somebody just know it and I want to know how the learn this magic.
<?xml version="1.0"?>
<layout>
<checkout_onepage_index>
<reference name="head"></reference>
</checkout_onepage_index>
</layout>
How do I know what handles if let say I want to modify the success page instead? or the frontend order detail page? etc...?
magento-1.9 layout
magento-1.9 layout
asked May 29 '15 at 23:00
YeoYeo
210212
210212
add a comment |
add a comment |
4 Answers
4
active
oldest
votes
In the simplest case, layout handles represent frontName_controller_action
.
So, in your example:
frontName
ischeckout
for theMage_Checkout
module (as defined by itsconfig.xml
file in the<routers></routers>
section).
controller
isonepage
forMage_Checkout_OnepageController
.
action
isindex
forMage_Checkout_OnepageController::indexAction()
Note that this is only the simplest case. Layout handles can be created/added in many other places and ways, such as the catalog logic (PRODUCT_TYPE_x
layout handles for different product types).
A good way of finding layout handles to use is to check the files in design/frontend/base/default/layout
- this directory stores all of the layout files of the base package/theme, and it has most (if not all) of the out of the box layout handles that you can utilize.
isfrontName_controller_action
just a conventions? I believed there are some handles which does not follow these pattern, is it true?
– Yeo
May 30 '15 at 7:15
Yup, that's just a convention for most controllers. And, yes, there are plenty of other layout handles, and you can even add your own.
– Agop
May 30 '15 at 17:03
add a comment |
You can add this to your controller action.
It will show handles in more neat way than var_dump.
Strange that this answer is not already on stack.
Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
add a comment |
We wrote down, how the handle is built (and many other things) here:
http://theslidesareonline.de/magento-in-30-minutes-en.pdf
and we wrote down a few layout handles which one should know, like customer_logged_in|out
Custom Action
Layout handle will be build with the NODE name!
<routers>
<companyModule_frontend>
<use>standard</use>
<args>
<module>Company_Module</module>
<frontName>frontend</frontName>
</args>
</companyModule_frontend>
</routers>
Route: frontend//
Layout Handle: companyModule_frontend_controllerName_actionName
Phtandard Layout-Handle
^ Magento uses only parts of the Layout-XML file, depending on the requested page. These parts are called layout handle. There are a few which are used every time, and others which are belonging to exactly one URL
The most important Layout-Handles
which don't belong to a page:
(all pages)
(customer status)
(category w/o LN)
(category with LN)
(all categories)
(product detail page)
Special Layout-Handle
<PRODUCT_TYPE_(simple|configurable|grouped|virtual|downloadable|bundle{|giftcard})
Custom Layout handle
Easiest: add one with an observer
public function addMyOwnLayoutHandle(){
Mage::app()->getLayout()->addHandle('my_own_handle');
}
than you can use in layout XML
<layout>
<my_own_handle>
add a comment |
The convention is made this way because before loading the layout magento first search for the handle with this type of handle,so that it can find the template from the controller.But you can make your own custom handles
public function controllerActionLayoutLoadBefore(Varien_Event_Observer $observer)
{
/** @var $layout Mage_Core_Model_Layout */
$layout = $observer->getEvent()->getLayout();
$id = Mage::app()->getRequest()->getParam('id');
/* or */
if($ourCoolObject = Mage::registry('our_cool_object'))
{
$id = $ourCoolObject->getId();
}
$layout->getUpdate()->addHandle('OUR_COOL_OBJECT_'.$id);
}
By the way there are 5 type of handles briefed below and we are talking about the fourth one here.
default
STORE_bare_us
THEME_frontend_default_default
helloworld_index_index
customer_logged_out
For more info refer
http://alanstorm.com/layouts_blocks_and_templates
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f69505%2fhow-to-find-out-which-layout-handles-to-be-changed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
In the simplest case, layout handles represent frontName_controller_action
.
So, in your example:
frontName
ischeckout
for theMage_Checkout
module (as defined by itsconfig.xml
file in the<routers></routers>
section).
controller
isonepage
forMage_Checkout_OnepageController
.
action
isindex
forMage_Checkout_OnepageController::indexAction()
Note that this is only the simplest case. Layout handles can be created/added in many other places and ways, such as the catalog logic (PRODUCT_TYPE_x
layout handles for different product types).
A good way of finding layout handles to use is to check the files in design/frontend/base/default/layout
- this directory stores all of the layout files of the base package/theme, and it has most (if not all) of the out of the box layout handles that you can utilize.
isfrontName_controller_action
just a conventions? I believed there are some handles which does not follow these pattern, is it true?
– Yeo
May 30 '15 at 7:15
Yup, that's just a convention for most controllers. And, yes, there are plenty of other layout handles, and you can even add your own.
– Agop
May 30 '15 at 17:03
add a comment |
In the simplest case, layout handles represent frontName_controller_action
.
So, in your example:
frontName
ischeckout
for theMage_Checkout
module (as defined by itsconfig.xml
file in the<routers></routers>
section).
controller
isonepage
forMage_Checkout_OnepageController
.
action
isindex
forMage_Checkout_OnepageController::indexAction()
Note that this is only the simplest case. Layout handles can be created/added in many other places and ways, such as the catalog logic (PRODUCT_TYPE_x
layout handles for different product types).
A good way of finding layout handles to use is to check the files in design/frontend/base/default/layout
- this directory stores all of the layout files of the base package/theme, and it has most (if not all) of the out of the box layout handles that you can utilize.
isfrontName_controller_action
just a conventions? I believed there are some handles which does not follow these pattern, is it true?
– Yeo
May 30 '15 at 7:15
Yup, that's just a convention for most controllers. And, yes, there are plenty of other layout handles, and you can even add your own.
– Agop
May 30 '15 at 17:03
add a comment |
In the simplest case, layout handles represent frontName_controller_action
.
So, in your example:
frontName
ischeckout
for theMage_Checkout
module (as defined by itsconfig.xml
file in the<routers></routers>
section).
controller
isonepage
forMage_Checkout_OnepageController
.
action
isindex
forMage_Checkout_OnepageController::indexAction()
Note that this is only the simplest case. Layout handles can be created/added in many other places and ways, such as the catalog logic (PRODUCT_TYPE_x
layout handles for different product types).
A good way of finding layout handles to use is to check the files in design/frontend/base/default/layout
- this directory stores all of the layout files of the base package/theme, and it has most (if not all) of the out of the box layout handles that you can utilize.
In the simplest case, layout handles represent frontName_controller_action
.
So, in your example:
frontName
ischeckout
for theMage_Checkout
module (as defined by itsconfig.xml
file in the<routers></routers>
section).
controller
isonepage
forMage_Checkout_OnepageController
.
action
isindex
forMage_Checkout_OnepageController::indexAction()
Note that this is only the simplest case. Layout handles can be created/added in many other places and ways, such as the catalog logic (PRODUCT_TYPE_x
layout handles for different product types).
A good way of finding layout handles to use is to check the files in design/frontend/base/default/layout
- this directory stores all of the layout files of the base package/theme, and it has most (if not all) of the out of the box layout handles that you can utilize.
answered May 29 '15 at 23:18
AgopAgop
544211
544211
isfrontName_controller_action
just a conventions? I believed there are some handles which does not follow these pattern, is it true?
– Yeo
May 30 '15 at 7:15
Yup, that's just a convention for most controllers. And, yes, there are plenty of other layout handles, and you can even add your own.
– Agop
May 30 '15 at 17:03
add a comment |
isfrontName_controller_action
just a conventions? I believed there are some handles which does not follow these pattern, is it true?
– Yeo
May 30 '15 at 7:15
Yup, that's just a convention for most controllers. And, yes, there are plenty of other layout handles, and you can even add your own.
– Agop
May 30 '15 at 17:03
is
frontName_controller_action
just a conventions? I believed there are some handles which does not follow these pattern, is it true?– Yeo
May 30 '15 at 7:15
is
frontName_controller_action
just a conventions? I believed there are some handles which does not follow these pattern, is it true?– Yeo
May 30 '15 at 7:15
Yup, that's just a convention for most controllers. And, yes, there are plenty of other layout handles, and you can even add your own.
– Agop
May 30 '15 at 17:03
Yup, that's just a convention for most controllers. And, yes, there are plenty of other layout handles, and you can even add your own.
– Agop
May 30 '15 at 17:03
add a comment |
You can add this to your controller action.
It will show handles in more neat way than var_dump.
Strange that this answer is not already on stack.
Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
add a comment |
You can add this to your controller action.
It will show handles in more neat way than var_dump.
Strange that this answer is not already on stack.
Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
add a comment |
You can add this to your controller action.
It will show handles in more neat way than var_dump.
Strange that this answer is not already on stack.
Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
You can add this to your controller action.
It will show handles in more neat way than var_dump.
Strange that this answer is not already on stack.
Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());
answered Dec 15 '17 at 17:09
TheKitMurkitTheKitMurkit
118112
118112
add a comment |
add a comment |
We wrote down, how the handle is built (and many other things) here:
http://theslidesareonline.de/magento-in-30-minutes-en.pdf
and we wrote down a few layout handles which one should know, like customer_logged_in|out
Custom Action
Layout handle will be build with the NODE name!
<routers>
<companyModule_frontend>
<use>standard</use>
<args>
<module>Company_Module</module>
<frontName>frontend</frontName>
</args>
</companyModule_frontend>
</routers>
Route: frontend//
Layout Handle: companyModule_frontend_controllerName_actionName
Phtandard Layout-Handle
^ Magento uses only parts of the Layout-XML file, depending on the requested page. These parts are called layout handle. There are a few which are used every time, and others which are belonging to exactly one URL
The most important Layout-Handles
which don't belong to a page:
(all pages)
(customer status)
(category w/o LN)
(category with LN)
(all categories)
(product detail page)
Special Layout-Handle
<PRODUCT_TYPE_(simple|configurable|grouped|virtual|downloadable|bundle{|giftcard})
Custom Layout handle
Easiest: add one with an observer
public function addMyOwnLayoutHandle(){
Mage::app()->getLayout()->addHandle('my_own_handle');
}
than you can use in layout XML
<layout>
<my_own_handle>
add a comment |
We wrote down, how the handle is built (and many other things) here:
http://theslidesareonline.de/magento-in-30-minutes-en.pdf
and we wrote down a few layout handles which one should know, like customer_logged_in|out
Custom Action
Layout handle will be build with the NODE name!
<routers>
<companyModule_frontend>
<use>standard</use>
<args>
<module>Company_Module</module>
<frontName>frontend</frontName>
</args>
</companyModule_frontend>
</routers>
Route: frontend//
Layout Handle: companyModule_frontend_controllerName_actionName
Phtandard Layout-Handle
^ Magento uses only parts of the Layout-XML file, depending on the requested page. These parts are called layout handle. There are a few which are used every time, and others which are belonging to exactly one URL
The most important Layout-Handles
which don't belong to a page:
(all pages)
(customer status)
(category w/o LN)
(category with LN)
(all categories)
(product detail page)
Special Layout-Handle
<PRODUCT_TYPE_(simple|configurable|grouped|virtual|downloadable|bundle{|giftcard})
Custom Layout handle
Easiest: add one with an observer
public function addMyOwnLayoutHandle(){
Mage::app()->getLayout()->addHandle('my_own_handle');
}
than you can use in layout XML
<layout>
<my_own_handle>
add a comment |
We wrote down, how the handle is built (and many other things) here:
http://theslidesareonline.de/magento-in-30-minutes-en.pdf
and we wrote down a few layout handles which one should know, like customer_logged_in|out
Custom Action
Layout handle will be build with the NODE name!
<routers>
<companyModule_frontend>
<use>standard</use>
<args>
<module>Company_Module</module>
<frontName>frontend</frontName>
</args>
</companyModule_frontend>
</routers>
Route: frontend//
Layout Handle: companyModule_frontend_controllerName_actionName
Phtandard Layout-Handle
^ Magento uses only parts of the Layout-XML file, depending on the requested page. These parts are called layout handle. There are a few which are used every time, and others which are belonging to exactly one URL
The most important Layout-Handles
which don't belong to a page:
(all pages)
(customer status)
(category w/o LN)
(category with LN)
(all categories)
(product detail page)
Special Layout-Handle
<PRODUCT_TYPE_(simple|configurable|grouped|virtual|downloadable|bundle{|giftcard})
Custom Layout handle
Easiest: add one with an observer
public function addMyOwnLayoutHandle(){
Mage::app()->getLayout()->addHandle('my_own_handle');
}
than you can use in layout XML
<layout>
<my_own_handle>
We wrote down, how the handle is built (and many other things) here:
http://theslidesareonline.de/magento-in-30-minutes-en.pdf
and we wrote down a few layout handles which one should know, like customer_logged_in|out
Custom Action
Layout handle will be build with the NODE name!
<routers>
<companyModule_frontend>
<use>standard</use>
<args>
<module>Company_Module</module>
<frontName>frontend</frontName>
</args>
</companyModule_frontend>
</routers>
Route: frontend//
Layout Handle: companyModule_frontend_controllerName_actionName
Phtandard Layout-Handle
^ Magento uses only parts of the Layout-XML file, depending on the requested page. These parts are called layout handle. There are a few which are used every time, and others which are belonging to exactly one URL
The most important Layout-Handles
which don't belong to a page:
(all pages)
(customer status)
(category w/o LN)
(category with LN)
(all categories)
(product detail page)
Special Layout-Handle
<PRODUCT_TYPE_(simple|configurable|grouped|virtual|downloadable|bundle{|giftcard})
Custom Layout handle
Easiest: add one with an observer
public function addMyOwnLayoutHandle(){
Mage::app()->getLayout()->addHandle('my_own_handle');
}
than you can use in layout XML
<layout>
<my_own_handle>
edited yesterday
Glorfindel
2231412
2231412
answered Jun 1 '15 at 16:41
Fabian BlechschmidtFabian Blechschmidt
33.3k663172
33.3k663172
add a comment |
add a comment |
The convention is made this way because before loading the layout magento first search for the handle with this type of handle,so that it can find the template from the controller.But you can make your own custom handles
public function controllerActionLayoutLoadBefore(Varien_Event_Observer $observer)
{
/** @var $layout Mage_Core_Model_Layout */
$layout = $observer->getEvent()->getLayout();
$id = Mage::app()->getRequest()->getParam('id');
/* or */
if($ourCoolObject = Mage::registry('our_cool_object'))
{
$id = $ourCoolObject->getId();
}
$layout->getUpdate()->addHandle('OUR_COOL_OBJECT_'.$id);
}
By the way there are 5 type of handles briefed below and we are talking about the fourth one here.
default
STORE_bare_us
THEME_frontend_default_default
helloworld_index_index
customer_logged_out
For more info refer
http://alanstorm.com/layouts_blocks_and_templates
add a comment |
The convention is made this way because before loading the layout magento first search for the handle with this type of handle,so that it can find the template from the controller.But you can make your own custom handles
public function controllerActionLayoutLoadBefore(Varien_Event_Observer $observer)
{
/** @var $layout Mage_Core_Model_Layout */
$layout = $observer->getEvent()->getLayout();
$id = Mage::app()->getRequest()->getParam('id');
/* or */
if($ourCoolObject = Mage::registry('our_cool_object'))
{
$id = $ourCoolObject->getId();
}
$layout->getUpdate()->addHandle('OUR_COOL_OBJECT_'.$id);
}
By the way there are 5 type of handles briefed below and we are talking about the fourth one here.
default
STORE_bare_us
THEME_frontend_default_default
helloworld_index_index
customer_logged_out
For more info refer
http://alanstorm.com/layouts_blocks_and_templates
add a comment |
The convention is made this way because before loading the layout magento first search for the handle with this type of handle,so that it can find the template from the controller.But you can make your own custom handles
public function controllerActionLayoutLoadBefore(Varien_Event_Observer $observer)
{
/** @var $layout Mage_Core_Model_Layout */
$layout = $observer->getEvent()->getLayout();
$id = Mage::app()->getRequest()->getParam('id');
/* or */
if($ourCoolObject = Mage::registry('our_cool_object'))
{
$id = $ourCoolObject->getId();
}
$layout->getUpdate()->addHandle('OUR_COOL_OBJECT_'.$id);
}
By the way there are 5 type of handles briefed below and we are talking about the fourth one here.
default
STORE_bare_us
THEME_frontend_default_default
helloworld_index_index
customer_logged_out
For more info refer
http://alanstorm.com/layouts_blocks_and_templates
The convention is made this way because before loading the layout magento first search for the handle with this type of handle,so that it can find the template from the controller.But you can make your own custom handles
public function controllerActionLayoutLoadBefore(Varien_Event_Observer $observer)
{
/** @var $layout Mage_Core_Model_Layout */
$layout = $observer->getEvent()->getLayout();
$id = Mage::app()->getRequest()->getParam('id');
/* or */
if($ourCoolObject = Mage::registry('our_cool_object'))
{
$id = $ourCoolObject->getId();
}
$layout->getUpdate()->addHandle('OUR_COOL_OBJECT_'.$id);
}
By the way there are 5 type of handles briefed below and we are talking about the fourth one here.
default
STORE_bare_us
THEME_frontend_default_default
helloworld_index_index
customer_logged_out
For more info refer
http://alanstorm.com/layouts_blocks_and_templates
answered May 30 '15 at 7:58
Rahul KathuriaRahul Kathuria
837
837
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f69505%2fhow-to-find-out-which-layout-handles-to-be-changed%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown