What is “Custom Layout Update”

Please LogIn to Reply!

Post By: admin | 26-01-2012 06:35 Reply

 

What is the custom layout update in product management -> product information -> design -> custom layout update?

I am not sure what is capable within this box and would love to know as it seems like it could be very useful. Thanks for any info/help.

 

Niktronix, you guessed it. “Custom Layout Update” is extremely powerful because it allows you to use Magento’s XML-based layout on a per product in this case. (You can also use Custom Layout Updates in other places in Magento, categories for example).

If you’re not familiar with Magento’s layout functionality I recommend you head over to Magento’s official <a href="http://www.magentocommerce.com/design_guide/articles/intro-to-layouts">intro to the feature</a>. If you want to go into more depth check out this <a href="http://magebase.com/magento-tutorials/demystifying-magentos-layout-xml-part-1/">tutorial</a>.

Now assuming you know how to utilize layouts, try adding some code into the “Custom Layout Update” field.

Simple example:

<remove name="header" />

You can see what the result is <a href="http://sand.michaeldbower.com/magento/1-5-0-1/">here</a> (home page = normal) and <a href="http://sand.michaeldbower.com/magento/1-5-0-1/index.php/test.html">here</a> (product page, has custom layout above applied).

 Signature 

MICHAEL BOWER DIGITAL

GET ‘EM, SELL ‘EM, KEEP ‘EM

 

Good to hear that we have some great flexibility here. What my next question is and I will take a look at the links provided, but will I have the ability to actually shift/move things around on the actual product page? For example where the photo resides, the options, the descriptions, the add to cart button, etc....? This is what I am definitely interested in and would love to be able to do for our product pages.

 

First, I must warn you that you should use this feature carefully, it’s very simple to mess up with a corresponding page and have the layout compromised and even completely broken.

Second, you can move blocks in layout, that’s true, but you can do it by creating known blocks, removing some of them, or adding so called “actions” to the existing blocks. If you want to neatly position some of the visuals on the page, you shouldn’t look this way, you should play with skins and templates.

And finally, there are three places in Magento where you can add your own custom layout instructions: product page, category page and CMS page. You have to remember that your instructions will be incrementally added to the existing layout and applied after the common layout is loaded.

It’s hard to explain in two words what exactly layout updates are, you really need to abovementioned links and learn.

Hope it helps.

 Signature 

Magento, go!
wink

 

Ok.... I am learning more about this powerful feature. We are looking seriously looking at magento go for simplicity of not having to host it and keep it updated.

This is where the importance of the custom layout update comes into play.

If you take a look at this link almost at the very bottom of the page:

http://www.magentocommerce.com/design_guide/articles/magento-design-terminologies4#term-structural-blocks

You will see the different “block”. There are the content blocks and I would be interested in not moving those actual blocks around, but actually moving or reorganizing the content inside the product listing (main) for a specific item through the custom layout update text area in the catalog management -> item information. Is that possible w/o accessing the files on the server b/c this is the one limitation that magento go has. I’m not concerned with how to do it at this very moment. It is just important to know that we can in the future when we want to fine tune our product pages.

Any insight on this specific question would be of great value. Thanks for those who have already replied with the information rich posts.

 

Structural and content blocks are in fact the same blocks. To be clear, every block definition in a layout update file always corresponds to a physical block, which is Magento class of specific type. For instance, the following block definition

<reference name="content">
    <
block type="catalogsearch/result" name="search.result" template="catalogsearch/result.phtml">
        <
block type="catalog/product_list" name="search_result_list" template="catalog/product/list.phtml">
            <
block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
                <
block type="page/html_pager" name="product_list_toolbar_pager"/>
            </
block>
            <
action method="addColumnCountLayoutDepend"><layout>empty</layout><count>6</count></action>
            <
action method="addColumnCountLayoutDepend"><layout>one_column</layout><count>5</count></action>
            <
action method="addColumnCountLayoutDepend"><layout>two_columns_left</layout><count>4</count></action>
            <
action method="addColumnCountLayoutDepend"><layout>two_columns_right</layout><count>4</count></action>
            <
action method="addColumnCountLayoutDepend"><layout>three_columns</layout><count>3</count></action>
            <
action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
        </
block>
        <
action method="setListOrders"/>
        <
action method="setListModes"/>
        <
action method="setListCollection"/>
    </
block>
</
reference>

has the following meaning:

1. Find a block called “content” and set the context to it.
2. Append a new block of the “catalogsearch/result” which corresponds to the physical block Mage_CatalogSearch_Block_Result. Creating a new block means that when the layout is being loaded, a new instance of the specified block is created.
3. Create a child block of the type “catalog/product_list” (Mage_Catalog_Block_Product_List) attached to the newly created Mage_CatalogSearch_Block_Result instance.
4. Create a child block of the type “catalog/product_list_toolbar” (Mage_Catalog_Block_Product_List_Toolbar) attached to the newly created Mage_CatalogSearch_Block_Result instance.
5. Create a child block of the type “page/html_pager” (Mage_Page_Block_Html_Pager) attached to the newly created Mage_Catalog_Block_Product_List_Toolbar instance.
6. Instantly after the initialization, call the addColumnCountLayoutDepend() public method of the Mage_Catalog_Block_Product_List instance several times with different arguments.
7. Instantly after the initialization, call the setListOrders(), setListModes() and setListCollection() public methods of the Mage_CatalogSearch_Block_Result instance.

It may be confusing, yet it gives a proper understanding of what is happening in reality. You must always remember though that the fact you have created some block as a child of another block doesn’t mean at all that created block will at once appear visible inside the area of the parent block. Every parent MUST render it’s children, it’s the rule. Some blocks, like greater structural blocks like left, right, content and some other just can render their children instantly, that’s what they do. But most of the blocks that have a template will only render children if their templates can directly put children’s rendered content somewhere inside them.

Now, I’ll add a bit regarding Magento Go. Imagine you have created a system with a very strong limitations that allow people to use the system as SaaS and don’t mess up with the source code. Magento Go just cannot allow its tenants a glimpse inside either source code or any of internal formats that Magento uses (and Magento Go in it’s very base still old good standard Magento with certain fundamental changes). Why am I telling you all this?

In spite MGo still allows Custom Layout Updates in the same three places the standard Magento allows, they become too dangereous for such system. No, using them won’t break MGo internal mechanisms, no way, but it may break the customer’s visual appeal, badly, and in opposition to the standard Magento there is no way to tell MGo developer “go look at the app/design/frontend/base/default/layout/catalogsearch.xml” and you’ll know what instructions to put to your custom layout updates to properly modify your category page.

Thus, I strongly recommend NOT to use those features in MGo, most probably in the next releases this feature will be sealed and changed to something similar to some enhanced specific Design Theme Editor as it is done for other pages.

Hope it helps.

 Signature 

Magento, go!
wink

 

Hello,
In custom layout update we are going to add layout for particular products
For example if we want to display compare product on all product view page
and we need to omit it on only one product this can be done with the help of
custom layout

 Signature 

Magento Themes Experts: Magento Themes | Download magento themes | ECommerce Developer

 

Very true.

For standalone Magento, there would be no other way. For Magento Go, FOR NOW, too.

But in the future, I believe, there will be a button instead of the Custom Layout Update field that will just start another Block Management window where you will be able to add or remove or move blocks for this specific product, or category, or CMS page. At least, I hope it will happen soon.

Please remember, it’s just a speculation for now.

 Signature 

Magento, go!
wink

 

Thank you for all the help and suggestions. I think that pretty much closes my questions regarding the topic at this point. I hope to see some real customization features for the main content block (actual product section) in the future this year.

`Reply Or Comment!
Please LogIn to Reply!