1

I would like to put a full-width block just before my footer on my search results page (<catalogsearch_result_index>) using my local.xml file, but I can't seem to figure out how to do it.

I have a block I made as a core/template type that is working on other pages. It is a carousel with products in it. When I add it to the search results page, it shows up on the right side, not taking up the full width because it is a 2columns-left page.

I could add the block inside the footer itself at the top (which I have also had trouble accomplishing), but this would not be ideal since the background color for the footer differs from the block.

So, do you know of any way I can accomplish what I am trying to do?

Thank you.

1 Answer 1

3

If you edit

{magento_root}/app/design/frontend/{custom_package}/{custom_theme}/template/page/2columns-left.phtml

And just after the left column you add

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

Then in your local.xml

<catalogsearch_result_index>
    <reference name="root">
     <block type="core/template" name="full_width" as="full_width" template="path/to/template.phtml" />
    </reference>
</catalogsearch_result_index>

Where template="path/to/template.phtml" is the path to your template file. For instance if you added the template to the same folder as the 2columns-left.phtml then the template value would be template="page/full_width_static_block.phtml"

12
  • Thank you for your reply. I used the exact code you gave me and made a file called full_width_static_block.phtml and put the word "test" in it. The div is showing up, but the word "test" is not there. Any ideas what I might have done wrong? Thank you.
    – b_d_m_p
    Commented Nov 17, 2014 at 3:51
  • By cms static block I meant the static blocks configured in the backend. Will update my answer to use the template file (.phtml) Commented Nov 17, 2014 at 4:10
  • I forgot to include the reference node to so that the block is added as a child of the root block in your local.xml Commented Nov 17, 2014 at 4:24
  • I see. Thanks so much. I got it working with your second answer. Out of curiosity, why would someone use the static blocks configured in the backend? I found editing in the backend very annoying, so I made core/template type phtml files and call them in. Do the static blocks configured in the back end have some kind of advantage?
    – b_d_m_p
    Commented Nov 17, 2014 at 4:29
  • No advantage other that it's being able to edit in the admin pannel. Someone who isn't a programer or doesn't know Magento can update these without to much trouble or breaking things. Commented Nov 17, 2014 at 4:33

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.