0

I have magento 1.9.1 with the theme "trego". On the home page I have black background, there I want to use a logo with white color, the product pages have white background, there I require a logo with black color.

how can I use different logos for different pages?

Example logo code:

 <a href="http://example.com/" title="Magento Commerce" class="logo"><img src="http://example.com/skin/frontend/default/trego/images/logo.png" alt="Magento Commerce"></a>
1

You will deal with templates and the local.xml file, which you can create under your theme folder.

I will assume some configurations:

  • That your theme is under app/skin/frontend/rwd/yourtheme/;
  • That you have a local.xml file inside app/skin/frontend/rwd/yourtheme/layout;
  • That exists a header.phtml file in app/skin/frontend/rwd/default/template/page/html/;
  • That you have 2 different .phtml files, each one with the HTML for the corresponding logo: whitelogo.phtml and blacklogo.phtml;

So, first you copy the header.phtml from the above dir into app/skin/frontend/rwd/yourtheme/template/page/html/ and edit it: put <?php echo $this->getChildHtml("logo"); ?> in header where you want the logo to appear.

Copy the whitelogo.phtml and blacklogo.phtml also in this same directory.

Then you edit the local.xml file:

<?xml version="1.0" encoding="utf-8"?>
<layout version="0.1.0">
    <catalog_product_index>
        <reference name="header">
            <block type="core/template" name="logo" template="page/html/blacklogo.phtml"/>
        </reference>
    </catalog_product_index>
    <cms_index_index>
        <reference name="header">
            <block type="core/template" name="logo" template="page/html/whitelogo.phtml"/>
        </reference>
    </cms_index_index>
</layout>

And this should work. In your homepage you will have the white logo and in the product page the other logo.

0

You can do this fairly easy with php or css. If you decide to go the php route you are probably going to want to setup another system config option for a second logo option.

The easiest, but not so managable, way to accomplish this would be within CSS. You could easily set the logo to a background-image and change this based on the body url (i.e. cms-index-index).

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.