Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8306929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:25:42+00:00 2026-06-08T18:25:42+00:00

After stumbling upon the following class while looking at magento source code: Mage_Core_Block_Template_Facade, i

  • 0

After stumbling upon the following class while looking at magento source code: Mage_Core_Block_Template_Facade, i have absolutely no idea what this class does.

Obviously i have looked at it and investigated a little bit but it just is not clear to me.

Can anyone explain its purpose in life and when it might be useful to use

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:25:43+00:00Added an answer on June 8, 2026 at 6:25 pm

    Mage_Core_Block_Template_Facade, is actually quite simple to understand. It..

    • Allows a value to be set on the block
    • Allows layout to specify an attribute/value from a registry object to be set on the block
    • Allows the equality of the two values above to be evaluated

    Essentially, this is what makes the Facade Block different from other blocks – the interaction with the registry and comparing a registry key/value with a block instance key/value – all from layout xml.

    There is only one example of the block being used in core code…

    Looking in catalog.xml and product/view.phtml you will see container1 and container2 blocks – they are both identical, but only one is ever rendered in the final output.

    So why are they both there? This will explain how Mage_Core_Block_Template_Facade works.

    Core is using the facade block as a method to allow the product options block position within product/view.phtml (not within the layout, but within the template itself) to be configurable from in the admin area. If you look in the design tab whilst editing a product, you should notice the last option: “Display Product Options In” – the two dropdown values correlate each to the container1 and container2 blocks that you can see in catalog.xml and view.phtml. Specifically, looking in product/view.phtml you should see container1 and container2 positioned in different divs.

    Layout decides which of these blocks to display based on the value set in “Display Product Options In” using the facade block.

    Here is how it works…


    Check catalog.xml and you will see:

    <block type="core/template_facade" name="product.info.container1" as="container1">
        <action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action>
        <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
        <action method="append"><block>product.info.options.wrapper</block></action>
        <action method="append"><block>product.info.options.wrapper.bottom</block></action>
    </block>
    <block type="core/template_facade" name="product.info.container2" as="container2">
        <action method="setDataByKey"><key>alias_in_layout</key><value>container2</value></action>
        <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
        <action method="append"><block>product.info.options.wrapper</block></action>
        <action method="append"><block>product.info.options.wrapper.bottom</block></action>
    </block>
    <action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
    <action method="unsetCallChild"><child>container2</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
    

    setDataByKey

    <action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action>
    

    This sets an identifier for this block that will be evaluted against the registry object. In the context of the options containers, this value will have to match one of the dropdown values in the admin area mentioned previously.

    setDataByKeyFromRegistry

    <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
    

    Tells the block “hey, when we need to look at product object in the registry and grab the value of the options_container key/attribute”. Akin to: Mage::registry('product')->getData('options_container');

    We would expect this value to be container1 or container2 in this specific example.

    ifEquals

    Finally, ifEquals is called in conjunction with unsetCallChild to remove the container not selected in the admin area.

    using container1 as an example…

    <action method="unsetCallChild"><child>container1</child><call>ifEquals</call><if>0</if><key>alias_in_layout</key><key>options_container</key></action>
    

    this calls the ifEquals method on that block instance, if the return value is 0 then container1 will be unset and not rendered.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm confused. After stumbling upon this thread, I tried to figure out how to
After deploying WCF server (svc) on my Server, I have got this message when
This has been stumping me for a bit. I have a Class written in
After doing an AJAX call, am redirecting- using the following code. But, after AJAX
After using Instruments, I have found the a spot in my code that is
After using the following code no errors are shown, but my database is not
I'm stumbling out of the blocks on this one. I can't get this code
So I nearly have this thing figured out, but I am stumbling over the
I am returning to C++ after a long absence and I am stumbling a
After following the RoR getting started tutorial, I added another model as: $ rails

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.