netz98 / N98_LayoutHelper

Helpful methods to be called in layout actions to allow more customizations via local.xml without touching the original layout files. Remove links from the account navigation from local.xml layout updates without touching the original layout files. Add CSS/JS before or after existing elements
Open Software License 3.0
33 stars 8 forks source link

Add external files #7

Open jwittorf opened 9 years ago

jwittorf commented 9 years ago

First off thanks for this module and all the work you guys already done for the community.

I was just wondering if you could add some more functionality to be able to add external files like this: http://inchoo.net/magento/how-to-add-external-javascript-css-file-to-magento/

                <action method="addExternalItem">
                    <type>external_css</type>
                    <name>//fonts.googleapis.com/css?family=Roboto:400,300,500,700</name>
                </action>
tkn98 commented 9 years ago

Sounds like an operation that is in context of this extension however as you point out with the hypertext-reference in your feature request, this is already solved by a different extension.

Can you share a little about why you request to duplicate the feature? Is there an issue to use both extensions together or similar?

jwittorf commented 9 years ago

By just having both extensions installed I get the following:

a:5:{i:0;s:169:"Invalid method N98_LayoutHelper_Block_Page_Html_Head::addExternalItem(Array
(
    [0] => external_css
    [1] => //fonts.googleapis.com/css?family=Oswald:400,300,700
)
)";i:1;s:2277:"#0 [internal function]: Varien_Object->__call('addExternalItem', Array)
#1 [internal function]: N98_LayoutHelper_Block_Page_Html_Head->addExternalItem('external_css', '//fonts.googlea...')
#2 L:\htdocs\mg.test\mage\app\code\core\Mage\Core\Model\Layout.php(348): call_user_func_array(Array, Array)
#3 L:\htdocs\mg.test\mage\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 L:\htdocs\mg.test\mage\app\code\core\Mage\Core\Model\Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#5 L:\htdocs\mg.test\mage\app\code\core\Mage\Core\Model\Layout.php(206): Mage_Core_Model_Layout->generateBlocks(Object(Mage_Core_Model_Layout_Element))
#6 L:\htdocs\mg.test\mage\app\code\core\Mage\Core\Controller\Varien\Action.php(344): Mage_Core_Model_Layout->generateBlocks()
#7 L:\htdocs\mg.test\mage\app\code\core\Mage\Cms\Helper\Page.php(113): Mage_Core_Controller_Varien_Action->generateLayoutBlocks()
#8 L:\htdocs\mg.test\mage\app\code\core\Mage\Cms\Helper\Page.php(52): Mage_Cms_Helper_Page->_renderPage(Object(Mage_Cms_IndexController), 'home')
#9 L:\htdocs\mg.test\mage\app\code\core\Mage\Cms\controllers\IndexController.php(45): Mage_Cms_Helper_Page->renderPage(Object(Mage_Cms_IndexController), 'home')
#10 L:\htdocs\mg.test\mage\app\code\core\Mage\Core\Controller\Varien\Action.php(418): Mage_Cms_IndexController->indexAction()
#11 L:\htdocs\mg.test\mage\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#12 L:\htdocs\mg.test\mage\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 L:\htdocs\mg.test\mage\app\code\core\Mage\Core\Model\App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#14 L:\htdocs\mg.test\mage\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#15 L:\htdocs\mg.test\mage\index.php(83): Mage::run('', 'store')
#16 {main}";s:3:"url";s:28:"/mg.test/mage/";s:11:"script_name";s:37:"/mg.test/mage/index.php";s:4:"skin";s:2:"de";}

The Firegento rewrite-check also point's out a conflict, take a look here: http://prntscr.com/89sfid

I've then added to Inchoo_Xternal.xml:

            <depends>
                <N98_LayoutHelper/>
            </depends>

This more or the less solves the problem, I'm not getting the error from above and can access the shop again. The Firegento rewrite-check hasn't changed and still points out a conflict.

Last but not least there's a conflict with Fooman_SpeedsterAdvanced (0.8.11) that's supposed to merge all the assets into one single file. Maybe there's a way to add files to its protected $_speedsterMergeBlacklist = array(); or the Mage::getStoreConfig('dev/js/speedster_merge_blacklist')

It would be great to have options/params like in TYPO3 to include css and js-items. Imo these are the most important ones in no particular order: