在Magento中,如何使用page.xml文件在自定义的两列左页中添加js或css文件.
我在page.xml中使用以下代码:168行
<page_two_columns_left translate="label">
<label>All Two-Column Layout Pages (Left Column)</label>
**<reference name="head">
<action method="addJs"><script>sidebar_menu.js</script></action>
</reference>**
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template> </action>
<!-- Mark root page block that template is applied -->
<action method="setIsHandle"><applied>1</applied></action>
</reference>
</page_two_columns_left>
Run Code Online (Sandbox Code Playgroud)
我可以将它放在2column-left.phtml中使用js/css,但我不认为这是方便的方式.我想使用xml添加.
我试图在本地池中使用我的自定义控制器重载/重写核心Onepagecontroller,但它无法正常工作.我正在使用Magento 1.5.1
这是我的文件结构和代码:
控制器文件:\ app\code\local\Odc\Mycheckout\controllers\OnepageController.php
require_once 'Mage/Checkout/controllers/OnepageController.php';
class Odc_Mycheckout_OnepageController extends Mage_Checkout_OnepageController
{
public function indexAction()
{
echo "This controller has been overridden.";
}
}
Run Code Online (Sandbox Code Playgroud)
config.xml文件:\ app\code\local\Odc\Mycheckout\etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<Odc_Mycheckout>
<version>0.0.1</version>
</Odc_Mycheckout>
</modules>
<global>
<controllers>
<Mage_Checkout>
<rewrite>
<onepage>Odc_Mycheckout_Onepage</onepage>
</rewrite>
</Mage_Checkout>
</controllers>
</global>
<frontend>
<routers>
<mycheckout>
<args>
<modules>
<Odc_Mycheckout before="Mage_Checkout">Odc_Mycheckout</Odc_Mycheckout>
</modules>
</args>
</mycheckout>
</routers>
</frontend>
</config>
Run Code Online (Sandbox Code Playgroud)
Odc_Mycheckout.xml文件:\ app\etc\module\Odc_Mycheckout.xml
<?xml version="1.0"?>
<config>
<modules>
<Odc_Mycheckout>
<active>true</active>
<codepool>local</codepool>
</Odc_Mycheckout>
</modules>
</config>
Run Code Online (Sandbox Code Playgroud)