Question

We have a site which has been running for a year or so with few major issues.

In the last few days various speed issues meant we revisited the cache problems we originally faced.

We had always left blocks_html output as disabled as enabling it caused SID's to be added to urls and this meant no one could navigate the site as the ID seemed to stop the menu from actually working. any click on a link with an SID didnt go anywhere. It also caused checkout issues which we never got to the bottom of.

So we left the block output turned off.

We since then moved to using varnish cache with turperntine.

Yesterday after some testing we decided to turn on the block html output as we believed another plugin may have caused the issues.

this was incorrect and it did reintroduce the SID error again. We disabled the block_html and cleared the cache. at which point the entire site was giving a Magento exception error as follows

Invalid method Mage_Page_Block_Html_Wrapper::addJs(Array
(
    [0] => prototype/prototype.js
)
)

Trace:
#0 [internal function]: Varien_Object->__call('addJs', Array)
#1 [internal function]: Mage_Page_Block_Html_Wrapper->addJs('prototype/proto...')
#2 /home/onlineeq/public_html/app/code/core/Mage/Core/Model/Layout.php(348): call_user_func_array(Array, Array)
#3 /home/onlineeq/public_html/app/code/core/Mage/Core/Model/Layout.php(214): Mage_Core_Model_Layout->_generateAction(Object(Mage_Core_Model_Layout_Element), Object(Mage_Core_Model_Layout_Element))
#4 /home/onlineeq/public_html/app/code/core/Mage/Core/Model/Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#5 /home/onlineeq/public_html/app/code/core/Mage/Core/Model/Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 /home/onlineeq/public_html/app/code/core/Mage/Core/Model/Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#7 /home/onlineeq/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#8 /home/onlineeq/public_html/app/code/core/Mage/Cms/Helper/Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#9 /home/onlineeq/public_html/app/code/core/Mage/Cms/Helper/Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#10 /home/onlineeq/public_html/app/code/core/Mage/Cms/controllers/IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#11 /home/onlineeq/public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(419): Mage_Cms_IndexController->indexAction()
#12 /home/onlineeq/public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#13 /home/onlineeq/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))
#14 /home/onlineeq/public_html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#15 /home/onlineeq/public_html/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#16 /home/onlineeq/public_html/index.php(88): Mage::run('', 'store')
#17 {main}

if we comment out prototype it brings up the scriptaculous.js instead. and so on.

We restored the site to the backup from before and it now works again. except we now cannot flush the cache without it erroring.

We had been able to flush the cache with no problem for the last year. this has just been introduced.

The only issue we could see would be with the menu which is using a JS library but this has no conflict in there so shouldnt be causing any issues.

Any thoughts or assistance with what the issue may be here would be most appreciated.

Specific issue if i have not been clear above is. Why cant i now flush cache without causing a javascript error?

EDIT

Many thanks oleksii.svarychevskyi your solution there worked for the JS errors. This was down to some fine tuning done about a month or so ago to try and get page loads working faster. clearly we have more to learn about magento still.

The JS errors now do not happen when we flush the cache . We are still getting SID when we enable the html block output as above. Should i make a new question specifically for this? or is it acceptable to ask for further help based on the above?

Was it helpful?

Solution

Check your layout xmls.

It seams like you have added <action method="addJs"> into some block type="page/html_wrapper" and not to the header block. You can do this action only inside <reference name="head">.

Search in code for method="addJs" and make sure that all of these action are inside <reference name="head"></reference>

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top