Magento 1.9 RWD Theme – Troubleshooting SCSS in Responsive Web Design

magento-1.9rwd-themescss

Can't for the life of me get my store to work with the custompackage/customtheme I created in this tutorial:
http://www.magentocommerce.com/knowledge-base/entry/ee114-ce19-rwd-dev-guide

I SSH'd into my server that has a brand new install of Magento 1.9.1, then used the exact commands given in the tutorial to create the new directories and copy the files over from the rwd theme. After that, I downloaded the new /scss directory onto my Windows machine and used Scout to generate the css files, and then uploaded those to my server at /skin/frontend/custompackage/customtheme/css.

As soon as I update the System->Configuration->General->Design->Package and Theme settings in Magento to custompackage and customtheme, I get the "There has been an error processing your request" Magento error page when I try to load my home page.

Anyone have any idea what sort of mistake I could have made to cause that error?

Thanks!

Edit- Here is the exception and backtrace generated by Magento:

a:5:{i:0;s:24:"Not valid template file:";i:1;s:4309:"  
0 /public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Page_Block_Html_Topmenu_Renderer->_toHtml()  
1 /public_html/app/code/core/Mage/Page/Block/Html/Topmenu.php(81): Mage_Core_Block_Abstract->toHtml()  
2 /public_html/app/design/frontend/base/default/template/page/html/topmenu.phtml(34): Mage_Page_Block_Html_Topmenu->getHtml('level-top')  
3 /public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/*/...')  
4 /public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/base/d...')  
5 /public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()  
6 /public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()  
7 /public_html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()  
8 /public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()  
9 /public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()  
10 /public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('topMenu', true)  
11 /public_html/app/design/frontend/base/default/template/page/html/header.phtml(46): Mage_Core_Block_Abstract->getChildHtml('topMenu')  
12 /public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/*/...')  
13 /public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/base/d...')  
14 /public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()  
15 /public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()  
16 /public_html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()  
17 /public_html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('header', true)  
18 /public_html/app/design/frontend/base/default/template/page/2columns-right.phtml(42): Mage_Core_Block_Abstract->getChildHtml('header')  
19 /public_html/app/code/core/Mage/Core/Block/Template.php(241): include('/home/*/...')  
20 /public_html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/base/d...')  
21 /public_html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()  
22 /public_html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()  
23 /public_html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()  
24 /public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()  
25 /public_html/app/code/core/Mage/Cms/Helper/Page.php(137): Mage_Core_Controller_Varien_Action->renderLayout()  
26 /public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')  
27 /public_html/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')  
28 /public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Cms_IndexController->indexAction()  
29 /public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')  
30 /public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))  
31 /public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()  
32 /public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)  
33 /public_html/index.php(87): Mage::run('', 'store')  
34 {main}";s:3:"url";s:1:"/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:7:"default";}

Here are the templates that I got when I made this call:

grep -E '(catalog/navigation|page/html/topmenu)' app/design/frontend/*/*/layout/*.xml

template="page/html/topmenu/renderer.phtml"
template="catalog/navigation/left.phtml"
template="page/html/topmenu.phtml"
template="catalog/navigation/top.phtml"

When I call

find app/design/frontend -path '*/template/path/to/template.html'

with those paths, I am able to find each of the templates referenced. They all exist in /frontend/rwd, except "top.phtml" which is only in /frontend/base and /frontend/default.

Why would this error exist once I switch to custompackage and customtheme, but not exist when I have package and theme both set to rwd? My /frontend/custompackage directory only contains /customtheme/etc/theme.xml which, as per the tutorial, reads as follows:

<?xml version="1.0"?>  
<theme>  
<parent>rwd/default</parent> 
</theme>

Best Answer

That error means you are missing the template file for the category menu. Your theme defines a template for it, but it's not installed.

To find out which template it's looking for, you can try:

grep -E '(catalog/navigation|page/html/topmenu)' app/design/frontend/*/*/layout/*.xml

Look for template="path/to/template.phtml" in the output and try to locate each file using:

find app/design/frontend -path '*/template/path/to/template.html'

This is the non invasive way. If that yields no results, you will need to insert a debug statement into the core file app/code/core/Mage/Page/Html/Topmenu/Renderer.php. The exception is really there, not sure why the backtrace in the report is incomplete. Starting from line 52, insert two debug statements:

    $includeFilePath = realpath(Mage::getBaseDir('design') . DS . $this->getTemplateFile());
    Mage::log('Resolving template '.$includeFilePath, null, 'template.log', true); // Debug line 1
    if (strpos($includeFilePath, realpath(Mage::getBaseDir('design'))) === 0 || $this->_getAllowSymlinks()) {
        $this->_templateFile = $includeFilePath;
    } else {
        Mage::log('Design base dir not at start but at index: ', strpos($includeFilePath, realpath(Mage::getBaseDir('design'))), null, 'template.log', true); // Debug line two
        throw new Exception('Not valid template file:' . $this->_templateFile);
    }

This will create a file template.log in the var/log directory. From the looks of it, there are symlinks involved or at least the checks here assume that based on the strpos() outcome. Very interesting to see the results.

Ok, you accepted the answer so you found the error. In my stock 1.9.0.1 install there's ./app/design/frontend/rwd/default/template/page/html/topmenu/renderer.phtml. For some reason your theme.xml is not respected. Cache can be an issue here. But with the information provided in the question, it seems you did everything right :).

Related Topic