magento-layout-xml

Magento: call a custom block in CMS

戏子无情 提交于 2019-12-25 03:42:25
问题 I’m trying to create my own module for Magento 1.9.1. In my module, I am trying to call a block in CMS content like this: {{block type="core/template" template="myNamespace/myModulOutput.phtml"}} The myModulOutput.phtml template contains a collection from my own controller: class myNamespace_myModelname_Block extends Mage_Core_Block_Template { public function getCollection() { // some code return $collection; } } The module seems to be active and shows up in Magento backend with this

Nested block within a reference not rendering when using ->getChildHtml()

混江龙づ霸主 提交于 2019-12-23 01:56:07
问题 this is my layout xml: <catalog_category_default translate="label"> <label>Catalog Category (Non-Anchor)</label> <reference name="content"> <block type="core/template" name="page.brand" template="page/brand.phtml" /> <block type="catalog/product_list" template="page/accessories.phtml"> <block type="catalog/navigation" name="catalog.leftnav" as="filter_menu" template="catalog/navigation/left.phtml"/> </block> </reference> </catalog_category_default> And from within page.accessories.phtml,

local.xml added to Magento layout directory but is not being applied and is ignored

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 01:43:07
问题 I'm using Alan Storm's advice from: Specify Category specific layout updates without using Magento's administration dashboard using several category specific layout updates inside of my local.xml. I have validated the xml, and it is being returned as valid xml. I have enabled mage developer mode to on to report an error and have looked at the exception logs to see if something is wrong, however no luck. here is my local.xml: <?xml version="1.0" encoding="UTF-8"?> <!-- /** * local.xml * *

How to add JS programmatically in Magento?

寵の児 提交于 2019-12-03 05:23:41
问题 I need to add a JS file conditionally and programmatically inside a block file. I tried with these codes: if (Mage::getStoreConfig('mymodule/settings/enable')) { $this->getLayout()->getBlock('head')->addJs('path-to-file/file1.js'); } else { $this->getLayout()->getBlock('head')->addJs('path-to-file/file2.js'); } However, regardless of what the setting is, none of this file is loaded. I even tried to eliminate the condition and explicitly load one file only, but it still doesn't work. What have

How can I hook on scripts and CSS into <head>?

╄→尐↘猪︶ㄣ 提交于 2019-11-30 14:14:16
问题 The thing with the module I am making is that it kind of generates a javascript snippet, so I cannot use an action to just hook that into the section of the HTML since the action requires that I have a JS file (correct me if I am wrong). What are some ways for me to put a JavaScript snippet into the tag? I was thinking of using a block, but I am not sure what the block should be appended after and I have to consider that this will work with all themes. 回答1: The stock head template is template

How can I hook on scripts and CSS into <head>?

跟風遠走 提交于 2019-11-30 09:57:26
The thing with the module I am making is that it kind of generates a javascript snippet, so I cannot use an action to just hook that into the section of the HTML since the action requires that I have a JS file (correct me if I am wrong). What are some ways for me to put a JavaScript snippet into the tag? I was thinking of using a block, but I am not sure what the block should be appended after and I have to consider that this will work with all themes. The stock head template is template/page/html/head.phtml Copying that file in your own theme would be the simplest way to get some javascript