I do not see any obvious signs on the front end of my store however when I enable the system.log and exception.log I'm seeing A LOT of entries.

First, from the system log, I'm seeing the following error (and corresponding code that is being referenced):

2013-06-04T22:55:31+00:00 ERR (3): Notice: Undefined variable: name in /home/XXXXXX/public_html/app/code/core/Mage/Page/Block/Html/Head.php on line 55

line 55: $this->addItem('skin_css', $name, $params);

2013-06-04T22:55:31+00:00 ERR (3): Warning: Missing argument 1 for Mage_Page_Block_Html_Head::addCss() in /home/XXXXXX/public_html/app/code/core/Mage/Page/Block/Html/Head.php on line 53

line 53: public function addCss($name, $params = "")

2013-06-04T22:55:35+00:00 ERR (3): Notice: Undefined variable: gravdept_filterClass in /home/XXXXXX/public_html/app/design/frontend/gravdept/acumen/template/catalog/layer/filter.phtml on line 38

echo '<li class="'.$gravdept_filterClass.'">
<a href="'.$_item->getUrl().'">'.$_item->getLabel().'</a>';

Then, in the exception.log, I'm seeing the following error over and over:

2013-06-04T23:01:14+00:00 ERR (3): 
exception 'Mage_Core_Exception' with message 'Invalid block type: ' in /home/XXXXXXX/public_html/app/Mage.php:594
Stack trace:
#0 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/Layout.php(495): Mage::throwException('Invalid block t...')
#1 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/Layout.php(437): Mage_Core_Model_Layout->_getBlockInstance('', Array)
#2 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/Layout.php(472): Mage_Core_Model_Layout->createBlock('', 'checkout.cart')
#3 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/Layout.php(239): Mage_Core_Model_Layout->addBlock('', 'checkout.cart')
#4 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/Layout.php(205): Mage_Core_Model_Layout->_generateBlock(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#5 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/Layout.php(210): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#7 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(269): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#8 /home/XXXXXXX/public_html/app/code/core/Mage/Checkout/controllers/CartController.php(159): Mage_Core_Controller_Varien_Action->loadLayout()
#9 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Checkout_CartController->indexAction()
#10 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#11 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /home/XXXXXXX/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#13 /home/XXXXXXX/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#14 /home/XXXXXXX/public_html/index.php(89): Mage::run('', 'store')
#15 {main}

Any ideas on how to fix these errors?


Answer for one of the errors, having run into it before...

line 55: $this->addItem('skin_css', $name, $params);

I'd start looking for a malformed line in your template layout local.xml, head.xml or page.xml

The Head.php block is being fed a configuration line with missing info.

Typical addCss type CSS load statements are as follows:

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

addItem statements have the ability to use parameters for conditional loading of either JavaScript or CSS.

Typical addItem type CSS load statements in layout xml files look like the following:

<action method="addItem"><type>skin_css</type><name>css/funky.css</name><params/><if>lt IE 8</if></action>

You need to tell it:

  1. the type of addItem
  2. relative path and name of file
  3. conditional parameters

Magento then goes to your current active template skin folder, looks for the css folder and loads the file. Apparently the file name is bunged up in one of the lines which causes Head.php to choke.

I'd run grep from the command line and look for all addItem lines in in the layout folder in my currently active template (paying close attention to the CSS versions and then back up and look for layouts added by third party modules.

  • Brilliant! This indirectly helped solve the problem. The issue was that one of the addCSS load statements was partially commented out while consolidating the css files. Only the path/file name was commented out while the action name itself was still executable. That explains why Head.php choked :) – riskywebmaster Jun 5 '13 at 7:17
  • Additional update: both errors were fixed, the 2nd error was due to a class calling for a missing function. Thanks Fiasco Labs, you inspired me to not put a fist thru the monitor and figure out the issues. – riskywebmaster Jun 5 '13 at 15:06
  • 1
    Glad to hear it! Many's the time... many's the time. The guys you see walking alongside the road shouting at the sky and bending down to hold great handwaving discourse with the bugs? They're all ex-Magento users who finally snapped. – Fiasco Labs Jun 6 '13 at 3:37

the first error

Undefined variable: name in /home/XXXXXX/public_html/app/code/core/Mage/Page/Block/Html/Head.php on line 55

can be generated by a layout section not set correctly just like @Fiasco Labs described,
Or (it happened to me before) because if the php version. I was working with php 5.3.10-1ubuntu3.4 and it had issues when casting a SimpleXmlElement to array. You can read more about it here

The issue Notice: Undefined variable: gravdept_filterClass in /home/XXXXXX/public_html/app/design/frontend/gravdept/acumen/template/catalog/layer/filter.phtml on line 38 is caused for sure by some custom code. Open the file suggested in the error message and see if the variable gravdept_filterClass is really defined above the line is used. It can be defined inside some if statement that you don't get to.
The last one Invalid block type: ' in /home/XXXXXXX/public_html/app/Mage.php:594 is most probably caused (again) by a wrong layout statement. in one of the layout files there is this:

<block name="checkout.cart">

Instead of

<reference name="checkout.cart">

I also had this issue before. See more details about it here

  • Yipes, talk about a sneak attack. It's bad enough when I flub a line in XML and get the most useless error stack trace in the world (xmllint is your friend, Magento just clams up and whispers weird things at you) and a crashed dev site while working in layouts. – Fiasco Labs Jun 6 '13 at 3:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.