How do I assign an alternative style.css according to a category?

Hi.

I’d like to switch to alternative style themes depending on the category chosen.
I’ve seen some reference to this in the German forums, but I can’t understand good enough to implement it.

Could someone please enlighten me?

This is Code for _header.tpl (or base.tpl), you can change the OXID of the category and the name of the css-File:


[{assign var="actCategory" value=$oView->getActiveCategory()}]
[{assign var="rootCategory" value=$actCategory->oxcategories__oxrootid->value}]
[{if $rootCategory=='30e44ab83fdee7564.23264141'}]
    <link rel="stylesheet" type="text/css" href="[{ $oViewConf->getResourceUrl() }]blue.css">
[{/if}]

Hi and thanks for the help so far.

I’m still missing some fundamental info though I think.

How do I define the categories that would adopt blue.css?
I see you’ve got:

$rootCategory=='30e44ab83fdee7564.23264141

but I can’t see where you got this ID from.

To expand on the same question. How could I add unique css styles to the check-out and the product detail page?

Many thanks!

This is the OXID of the root category - you´ll find it inside the database

The ID is the OXID field of the category, you can find it in PHPmyadmin if you search the category in oxcategories table.

Details page:


[{if $oView->getClassName() == "details"}]
    <link rel="stylesheet" type="text/css" href="[{ $oViewConf->getResourceUrl() }]blue.css">
[{/if}]

Checkout:

[{if $oView->getIsOrderStep()}]
    <link rel="stylesheet" type="text/css" href="[{ $oViewConf->getResourceUrl() }]blue.css">
[{/if}]