Search code examples
magentomagento-1.9

How to modify a small part in parent theme of Magento?


i'm working on a mobile theme that is based off the another custom theme in Magento, i want to include some specific css files only in the mobile theme so that the current custom theme won't be affected.

Let's call the layout file that i'm trying to modify as new_block.xml, i can copy the whole new_block.xml file to the new mobile theme, but i don't want to do that as it would be hard to maintain later if someone decides to change more things in new_block, is there any way to reference to parent theme and modify only some parts of it instead of overriding all of it for just a small change?

I'm using Magento 1.9


Solution

  • As you have already created mobile theme using the reference of main custom theme. you can use the local.xml specific to your mobile theme to add custom css files.

    app/design/frontend/{package-name}/{mobile-theme-name}/layout/local.xml

    <?xml version="1.0">
    <layout>
    <default>
        <reference name="head">
             <action method="addCss"><stylesheet>css/custom_mobile.css</stylesheet></action>
        </reference>
    </default>
    </layout>
    

    There is no other way to reference parent theme layout file and modify only some parts.