2

I'm troubleshooting a site that has code inserted into the "Miscellaneous Scripts" (System -> Configuration -> Design -> HTML Head)but it is not being displayed on the frontend of the site.

If I view page source there is nothing from the Miscellaneous Scripts portion, however if I edit head.phtml and insert the code directly it appears immediately.

My question is, what code is responsible for inserting the scripts into the head portion (presumably I could copy and paste the code into the head.phtml?)and what could cause the script not to appear at all?

1 Answer 1

2

The code responsible is getIncludes() defined in Mage_Page_Block_Html_Head:

public function getIncludes()
{
    if (empty($this->_data['includes'])) {
        $this->_data['includes'] = Mage::getStoreConfig('design/head/includes');
    }
    return $this->_data['includes'];
}

And called in head.phtml:

echo $this->getIncludes();

A possible cause is that the miscellaneous scripts are empty when you switch the config to the store view.

Edit: seems like the real cause was that a module was rewriting Mage_Page_Block_Html_Head

8
  • Okay I dont have echo $this->getIncludes(); anywhere in head.phtml and the code is present.
    – SR_Magento
    Oct 6, 2016 at 16:01
  • @SR_Magento try to run grep -r "$this->getIncludes()" . on your magento root folder. Also try grep -r "design/head/includes" . Oct 6, 2016 at 16:03
  • Okay it is there in the head (guess I missed it) so now I need to know why its not displaying.
    – SR_Magento
    Oct 6, 2016 at 16:06
  • @SR_Magento as I say it could be because the field is empty when you change scope to the store view in the config and the Use Default Value checkbox is unticked Oct 6, 2016 at 16:08
  • The script contents are there for each store view. Is there possibly a core module that could be disabled responsible?
    – SR_Magento
    Oct 6, 2016 at 16:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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