Ovidiu
Ovidiu

Reputation: 2931

Add block from local.xml in Magento

I need to add a custom block on a page. Doesn't really matter where. For this example, I want it on customer/account/

So, looking on customer.xml I see this path:

   <customer_account_index translate="label">
       [code]
       <reference name="my.account.wrapper">
           [code]
       </reference name="my.account.wrapper">
   </customer_account_index>

Following this example here is my code in local.xml

    <customer_account_index>
    <reference name="my.account.wrapper">
        <block type="core/template" 
           name="customer_groupsprogressbar"          
           template="customer/groupsprogressbar.phtml" />
    </reference>
    </customer_account_index>

Something is wrong, because it doesn't appear. If I add that block in customer.xml instead all works fine.

Any clues on what I'm doing wrong here?

Upvotes: 1

Views: 4843

Answers (1)

Jevgeni Smirnov
Jevgeni Smirnov

Reputation: 3797

Try

<customer_account_index>
    <reference name="my.account.wrapper">
        <block 
            type="core/text_list" 
            name="customer_groupsprogressbar"          
            template="customer/groupsprogressbar.phtml" />
    </reference>
</customer_account_index>

Or

<customer_account_index>
    <reference name="my.account.wrapper">
        <block 
            type="core/template" 
            name="customer_groupsprogressbar"          
            template="customer/groupsprogressbar.phtml" output="toHtml" />
    </reference>
</customer_account_index>

OR in my.account.wrapper template:

<?php echo $this->getChildHtml('customer_groupsprogressbar'); ?>

Upvotes: 3

Related Questions