Allright, I figured it out, and it was quite easy.
In the your_template/common/html_header.php around line 53 an array is created that stores the values of the stylesheet names that will be loaded, here is where we will add a new value for our root category stylesheet.
First, above the array you have to create a new variable that will store the value of the root category.
Code:
$top_category = substr($cPath, 0, strpos($cPath, '_'));
Then in the array mentioned before ($sheets_array) needs to be modified to look like the following
Code:
$sheets_array = array('/' . $_SESSION['language'] . '_stylesheet',
'/' . $tmp_pagename,
'/' . $_SESSION['language'] . '_' . $tmp_pagename,
'/c_' . $top_category, //my top category search.
'/c_' . $cPath,
'/' . $_SESSION['language'] . '_c_' . $cPath,
'/m_' . $manufacturers_id,
'/' . $_SESSION['language'] . '_m_' . (int)$manufacturers_id,
'/p_' . $tmp_products_id,
'/' . $_SESSION['language'] . '_p_' . $tmp_products_id
);
The modified line is the fourth node in the array. It simply makes a node in the array that reflects the current top level category.
So there you have it, an easy way to load both primary category style sheets and sub-category sheets if you need them.
Bookmarks