0

How do I add a static CMS block to the customer logout page? I have it somewhat working, but the content of my CMS block shows twice:

  1. I setup a CMS block called logout_message with a bit of html in there.

  2. Added this to my local.xml

    <label>Customer Account Logout Success</label>
    
    <remove name="right"/>
    
    <remove name="left"/>
    
    <reference name="root">
    
        <action method="setTemplate"><template>page/1column.phtml</template></action>
    
    </reference>
    
    <reference name="content">
    
        <block type="core/template" name="customer_logout" template="customer/logout.phtml">
    
            <block type="cms/block" name="logout_message" as="logout_message">
    
                <action method="setBlockId"><block_id>logout_message</block_id></action>
    
            </block>
    
        </block>
    
    </reference>
    

  3. created my template/customer/logout.phtml:

    <div class="small-16 columns panel-fill ">
    
       <?php echo $this->getChildHtml('logout_message') ?>
    
    </div>
    

As I said the content of the static block shows twice - why? Small update - it actually outputs the content of the entire logout.phtml file, not just the CMS block.

1

You're basically re-inserting a customer_logout block in the content of the page.

Instead, it should be:

<reference name="customer_logout">        
    <block type="cms/block" name="logout_message" as="logout_message">
        <action method="setBlockId"><block_id>logout_message</block_id></action>
    </block>
</reference>
  • This does work if I place it in side the content reference - but not on it's own. Where did you get the customer_logout reference from? Trying to "find" this stuff is irritating. – Sean Kimball Sep 14 '15 at 15:53
  • It's the "name" of the block you want to add/remove stuff to. If you check page.xml, you will see that all the structural blocks are defined there. So when you do a reference to head or content, you are actually referencing a block. Just like your example. – Mayers Sep 15 '15 at 9:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.