Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Insert block (file.phtml) only on category pages
 
ricardoinvent
Member
 
Total Posts:  37
Joined:  2012-10-29
 

Hello friends,

I’m tring to customize a magento store with a theme. And now I need to customize the view of each category. I need that every time a user opens a category it shows a div with some personalized info. The div has to be located after <body>…

Then I create a divpersonalized.phtml. And at the same time I’m using a local.xml with all the mods in a custom theme (also in a separated folder). So in my local.xml file I’m tring to load the divpersonalized.phtml in this way.

<catalog_category_default translate="label">
        <
reference name="header">
            <
block type="page/html_header" name="header" as="header">
                 <
block type="page/html_header" name="divpersonalized" template="page/html/divpersonalized.phtml">
            </
block>
        </
reference>
    </
catalog_category_default>

But is not working. Could somebody helpme please?.. I need to get this done asap.

Warming regards!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
MagikSwapna
Sr. Member
 
Total Posts:  97
Joined:  2010-12-14
 

Hello,

Replace your code with this

<catalog_category_default translate="label">
        <
reference name="header">
            <
block type="page/html_header" name="header" as="header">
                 <
block type="page/html_header" name="divpersonalized" as="divpersonalized" template="page/html/divpersonalized.phtml">
            </
block>
        </
reference>
    </
catalog_category_default>
and following code under list.phtml file to display your block
<?php echo $this->getChildHtml('divpersonalized'?>
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top