3

I have followed the article here, http://alanstorm.com/magento_infinite_fallback_theme_xml and I have it working 99%. There is an odd thing happening that clearing the cache and all the moving around has not fixed for me. What happens is that if I define a css file it will not pull from the child**(Site B)** but it pull from the next parent up**(Site A)**. Here is what I have

(Site A) parent theme (wsu_base/default/etc/theme.xml)

<?xml version="1.0"?>
<theme>
    <parent>rwd/default</parent>
    <layout>
        <updates>
            <wsu_base>
                <file>wsu_base_defaults.xml</file>
            </wsu_base>
        </updates>
    </layout>
</theme>

(Site B) Child theme (wsu_base/test/etc/theme.xml)

<?xml version="1.0"?>
<theme>
    <parent>wsu_base/default</parent>
    <layout>
        <updates>
            <wsu_base>
                <file>wsu_base_defaults.xml</file>
            </wsu_base>
            <foundation_default>
                <file>defaults.xml</file>
            </foundation_default>
        </updates>
    </layout>
</theme>

parent layout (Site A) (wsu_base/default/layout/wsu_base_defaults.xml) and child (wsu_base/test/layout/defaults.xml) (Site B) both have this.

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <default>
    
        <reference name="head">
            <action method="addItem"><type>skin_css</type><name>css/custom.css</name></action> 

        </reference>

    </default>
</layout>

That css in the parent skin folder is (wsu_base/default/css/custom.css)(Site A)

body{ color:blue !important;}

and in the child I have (wsu_base/test/css/custom.css)(Site B)

body{ color:red !important;}

I expect everything to be red, but everything is blue. Now ok, maybe I can over come this by removing the <action method="addItem"><type>skin_css</type><name>css/custom.css</name></action> from the parent, and just keep it in the child. I do that and rm -rf /var/cache/ over and over, touch /var/ngx_pagespeed_cache/cache.flush over and over, make sure that the css and js folders are empty, turn off all caching, and ...... I still see blue! when I should see red.

I try to get smart with it too, in the child (Site B) I go

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <default>
        <reference name="head">
            <action method="removeItem"><type>skin_css</type><name>css/custom.css</name></action>
            <action method="addItem"><type>skin_css</type><name>css/custom.css</name></action>
        </reference>
    </default>
</layout>

thinking surely it'll remove the parent css first and load the child's, but it is STILL BLUE (although in some of the other tests I simple didn't make the call for the css in the parent and it was neither red or blue)... I have the system config value as it is in the article. I have even tried set the default set per store, but even when I did set the values for site B on "Skin (Images / CSS)", everything is blue..

update: It is also worth noting that if I go and add a template bases action, like addLinkBlock then it does work from the child theme (Site B) and doesn't show up on the parent theme (Site A) which is expected. Ror example in the child (Site B)

<?xml version="1.0" encoding="UTF-8"?>
<layout>
    <default>
        <reference name="head">
            <action method="removeItem"><type>skin_css</type><name>css/custom.css</name></action>
            <action method="addItem"><type>skin_css</type><name>css/custom.css</name></action>
        </reference>
        <reference name="top.links">
            <block type="wishlist/links" name="wishlist_link" />
            <action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
        </reference>
    </default>
</layout>

I will see the wishlist, and since the block is destroyed in the parent theme (Site A) it proves that the child (Site B) theme file (defaults.xml) is working and being read and the layout is updated.

FINAL

aka: v8 stamp

You have made it to the bottom, and there is a lesson we relive over and over as developers, check your paths, and then recheck them. So why was the css not making it, well in the editor it looked like the /skin folder was in the root, but some how it was in the /app folder. Well no wonder it was falling back to the parent, there was no custom.css file in the child theme (Site B) and that is what a fallback does. :\

I've not deleted this because it's a simple mistake even 20 year vets make, and it's just a good reminder that you should always triple check your paths and then step away and check again.

1
  • Do you know if this also works in admin page? How to set parent theme of custom made admin theme. @jeremy.bass
    – Anitr
    Commented Jul 27, 2017 at 13:02

1 Answer 1

1

I noted in the question but the answer was, check the path again cause it should pick up the '/skin' folder from the route and there was no reason for the layout updates not to work. How did I finally notice it? Well I have an extension Storeutilities that adds a few new types to pull css and js file from things like CDN's in the correct order and way as well as adding fallbacks. So I need to get the job done, and I just added external_css and went directly to where the css file should have been as a for now solution. Well one 404 later and I know what the original issue was, a path problem. That is it, thank you for your time. :\

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.