1

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?

5
  • Which local.xml are you talking about? Can you give the complete path to the file? Commented Feb 23, 2012 at 11:41
  • local.xml from template. app/design/frontend/default/THEME/layout/layout.xml Commented Feb 23, 2012 at 12:33
  • Check System->configuration->Design, what you you have in package? Should be default. Commented Feb 23, 2012 at 12:43
  • moreover does your shop has "THEME" theme? Commented Feb 23, 2012 at 12:43
  • yes, it is default. I just used THEME for exemplication, I'm using my theme name, not 'THEME'. Commented Feb 23, 2012 at 12:48

1 Answer 1

3

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'); ?>
Sign up to request clarification or add additional context in comments.

5 Comments

Sorry but i want to know do we need to place 'as' in <block>?
This is no necessary. as is alias. Means if you have <block name="a_b" as="a.b" ... /> then you can call it like this $this->getChildHtml('a_b') or $this->getChildHtml('a.b')
@JevgeniSmirnov first and second are not working. Third option could be working but is not what I need. I want this block in xml file only to be able to move wherever I want without modifying any template file.
Impossible, they both should work. Means they are not loaded at all. Check the third option please.
Damn, I'm so stupid. And blind apparently.. In fact the block was rendered just fine. But because layout.xml had not 'before' or 'after' instruction was all the way down but when called in customer.xml it was on top. So I was expecting to see on top too. So sorry guys and thank you for your effort.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.