1

when placing cms block in our website footer like thi with the code below. We see that the block id 'shopper_footer_links' is not picked up as a separate block. (when testing with template hints + Add add Block Names to Hints it is not shown). The only block name we see is html_footer (and not the blocks that reside within it).

I am asking because we use LEsti FPC and do not want to cache shopper_footer_links. But if it is not recognized as a block it cannot be cached/not-cached separately.

question: is there an easy way so Magento does see it as a separate block id? Or does this involve writing an extension (adding the html to something like footer_after)?

Many thanks, Sean

I tried these two methods. Same outcome.

    <?php echo $this->getBlockHtml('shopper_footer_links'); ?>

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

and in layout xml

    <reference name="footer">
    <block type="cms/block" name="shopper_footer_links" after="shopper_footer_links">
        <action method="setBlockId"><block_id>shopper_footer_links</block_id></action>
    </block>
    </reference>
8
  • 1
    why do you calling your block twice in phtml file ? also I can see you didn't set as attribute for your block. add as="shopper_footer_links" for your block,then clear the cache and then load the page again Oct 29, 2014 at 9:55
  • The two calls were just to show that i tried both methods (will clarify). I will add the AS and see if it works
    – snh_nl
    Oct 29, 2014 at 10:35
  • Like this? <block type="cms/block" name="shopper_footer_partners" as="shopper_footer_partners" after="shopper_footer_links"> <action method="setBlockId"><block_id>shopper_footer_partners</block_id></action> </block>
    – snh_nl
    Oct 29, 2014 at 10:37
  • tested. no still does not work. Also I can see in template/block hints that it is not recognized as a block
    – snh_nl
    Oct 29, 2014 at 10:41
  • yes.. that is it Oct 29, 2014 at 10:41

1 Answer 1

1

this seems to fix it

both action and parameter name_in_layout seem necessary

    <reference name="footer">

    <block type="cms/block" name="shopper_footer_partners" name_in_layout="shopper_footer_partners">
        <action method="setBlockId"><block_id>shopper_footer_partners</block_id></action>
        <action method="setNameInLayout"><name_in_layout>shopper_footer_partners</name_in_layout></action>
    </block>
    </reference>

Your Answer

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

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