3

Question #1: For some reason, I can't seem to get my custom CSS file to be implemented into the theme. I've basically done this with the page.xml:

Before:

<action method="addItem"><type>skin_css</type><name>css/styles-ie.css</name><params/><if>lt IE 9</if></action>
<action method="addItem"><type>skin_css</type><name>css/styles-iefont.css</name><params/><if>gt IE 6</if></action>
<action method="addCss"><stylesheet>css/widgets.css</stylesheet></action>
<action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>
<action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action>
<action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action>

After: (added inbetween)

<action method="addCss"><stylesheet>css/widgets.css</stylesheet></action>
<action method="addCss"><stylesheet>css/print.css</stylesheet><params>media="print"</params></action>

<action method="addCss"><stylesheet>css/hafner.css</stylesheet><params>media="screen"</params></action>
<action method="addItem"><type>skin_css</type><name>css/hafner.css</name></action>

<action method="addItem"><type>js</type><name>lib/ds-sleight.js</name><params/><if>lt IE 7</if></action>
<action method="addItem"><type>skin_js</type><name>js/ie6.js</name><params/><if>lt IE 7</if></action>

Am I missing something?

The code is in <block type="page/html_header" name="header" as="header">

Question #2: (the relevant one)

How to add custom CSS-files for single storeviews?

Answered by Jonathan Hussey (see below)

edit02: it seems I don't get it quite just yet.

</default>

<!-- CUSTOM -->
<STORE_hafner_de>
    <reference name="header">
        <action method="addCss"><stylesheet>css/hafner.css</stylesheet><params>media="screen"</params></action>
    </reference>
</STORE_hafner_de>

that </default> is just to show that <default> is closed

5
  • I've changed my question, thank you for the help with the previous one though.
    – theHubi
    Commented Nov 3, 2014 at 9:22
  • Please don't change the question if it has been answered. Instead, post a new question while linking to this question as the reference to follow-up.
    – Andrew T.
    Commented Nov 3, 2014 at 9:51
  • I've realized and accepted that already, however the first question was highly irrelevant. It was essentially me being stupid.
    – theHubi
    Commented Nov 3, 2014 at 10:00
  • @AndrewT. thanks to your edit however I can't repost my second question, because it has been answered in this thread, the first one, however, has only been commented. Which means the current answer is related to question #2, not the first one, so your re-edit is not really on-topic.
    – theHubi
    Commented Nov 3, 2014 at 10:08
  • Okay, I understand :) Feel free to improve this question by editing it, but make sure to make the answer still legit. Have a nice day!
    – Andrew T.
    Commented Nov 3, 2014 at 10:08

2 Answers 2

4

Use the STORE layout handle:

<?xml version="1.0"?>
<layout version="0.1.0">
    <STORE_en>
        <reference name="content">
            ...
        </reference>
    </STORE_en>
</layout>

Where en is the code of the store in question. This will add the layout changes to all pages for that store in the same way as the <default> layout handle does for all pages of all stores. By default there is no way to use the STORE layout handle and only have layout changes for certain pages in that store.

FYI, next time just create a new question rather than completely changing an existing one so the comments don't make any sense - SE is a resource for people to refer to in the future as well as a way for you to have your questions answered.

5
  • I know, sorry about that, but I felt the question was not as useful as I first expected it to be, since the cache was essentially the only problem. I guess I'm a bit tired today.
    – theHubi
    Commented Nov 3, 2014 at 9:33
  • so I basically use: <STORE_storename><block>...</block></STORE_storename> ?
    – theHubi
    Commented Nov 3, 2014 at 9:36
  • The STORE layout handle is used just like any other layout handle such as default or catalog_product_view. Commented Nov 3, 2014 at 9:43
  • which means I have to add this code either at the top or the bottom of the XML-file? <STORE_hafner_de> <reference name="content"> <action method=".."....</action> </reference> </STORE_hafner_de> after <default> closes?
    – theHubi
    Commented Nov 3, 2014 at 9:46
  • Yes you still have to reference, or create a block as normal within the handle. Commented Nov 3, 2014 at 9:48
0

Recently, I was trying to modify some color of a premium theme and saving it doesn't take any effect.

I tried to put into local.xml and page.xml without any success. Finally I figured out that this theme uses LESS. So I looked for LESS folders and edited my-theme.less (also my-theme.css into css folder). Then I refreshed cache and the change took effect.

This is how my parent's tree theme looks like:

skin
|
| ---- mypackage
    |
    |---- default
        |
        |---- less
        |   |
        |   |---- my-theme.less
        |---- css
        |   |
        |   |---- my-theme.css
        |---- images
        |
        |---- js

Hope this works for you.

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.