I have created a custom module that shows a block in "/checkout/cart/".
I use this code in default layout "checkout.xml" file:
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="mymodule/myblock.phtml"/>
How can I edit my module config file to load the phtml block in "/checkout/cart/" without editing the default layout files.
Thanks for help.
Create a local.xml file in your custom theme folder.
In the local.xml file reference the encapsulating block and add your block as a new node.
Example:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<reference
name="checkout.cart">
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="mymodule/myblock.phtml"/>
</reference>
</default>
</layout>
Related
I try to add a static block created in CMS -> static block (id : qualif).
To do this I create a local.xml in app/design/frontend/default/default/layout and I insert :
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="right">
<block type="cms/block" name="cms_qualif" after="-">
<action method="setBlockId"><block_id>qualif</block_id></action>
</block>
</reference>
</default>
</layout>
But anything appears on my right col.
I've check that my template is "default" in Admin -> System-> Design.
Have you any solution ?
Try to add the xml in catalog.xml after the <default> tag:
<reference name="right">
<block type="cms/block" name="cms_qualif" after="-">
<action method="setBlockId"><block_id>qualif</block_id></action>
</block>
</reference>
And don't forget to clear cache after you make the changes.
Hy,
I'm writing a custom module and I 'would like to add custom block to the app/design/frontend/mytemplate/default/template/catalog/product/view/type/default.phtml
I'cannot use the extra data place holder so I've to modify the default.phtm where I've added this code:
<?php echo $this->getChildHtml('msgdisp') ?>
in my module layout.xml I've written the following section:
<?xml version="1.0"?> <layout version="1.0.0">
<catalog_product_view>
<reference name="??????">
<block type="core/template" name="msgdisp" as="msgdisp" template="msgdisp/messaggiodisp.phtml"/>
</reference>
</catalog_product_view>
I'don't figure out what I've to put instead of ??????, so far I've tried:
product_type_data
product.info.simple
but no one of the above as worked.
In the messaggiodisp.phtml I've written a simple "placeholder" code
<!-- Hello World -->
please let me know what I'm doing wrong..
Ok, I've found a solution, I was wrong in the xml file:
<PRODUCT_TYPE_simple>
<reference name="product.info.simple">
<block type="core/template" name="msgdisp" as="msgdisp" template="msgdisp/messaggiodisp.phtml"/>
</reference>
I've created a child theme, with 'rwd' as the parent theme. The parent theme has this code in the 'head' block in page.xml:
<action method="addLinkRel"><rel>stylesheet</rel><href>//fonts.googleapis.com/css?family=Raleway:300,400,500,700,600</href></action>
is there a way of removing it in the child theme in local.xml?
Add this code in your local.xml file
<default>
<reference name="head">
<action method="removeItem"><type>link_rel</type><name>//fonts.googleapis.com/css?family=Raleway:300,400,500,700,600</name></action>
</reference>
</default>
This is not obvious but it is quite easy.
<action method="removeItem"><type>link_rel</type><href>//fonts.googleapis.com/css?family=Raleway:300,400,500,700,600</href></action>
I have the following layout xml
<reference name="content">
<block type="gate/paycheckout" name="payair.gate.paycheckout" before="-" template="gate/checkout.phtml"/>
<block type="gate/paymentjs" name="payair.gate.paymentjs" />
</reference>
I have a block by which i am calling the javascript on the payment.phtml and its working but i want to call the Magento addJs action method to add the javascript dynamically on the payment.phtml page not by calling the block. How can i do this?
You should add the script to head:
layout xml file:
<layout>
<name_of_the_handle>
<reference name="head">
<action method="addJs"><script>gate/payment.js</script></action>
</reference>
</name_of_the_handle>
...
</layout>
payment.js file should in this case be located in js/gate/payment.js
I have custom layout for category.
<CATEGORY_8>
<reference name="root">
<action method="setTemplate"><template>page/category_8.phtml</template></action>
</reference>
<reference name="left">
<block type="catalog/category_view" name="catalog.leftnav.within" before="-" template="catalog/layer/within.phtml "/>
</reference>
<reference name="category.products">
<action method="setTemplate"><template>catalog/category/8/view.phtml</template></action>
</reference>
<reference name="catalog.leftnav">
<action method="setTemplate"><template>catalog/layer/view_8.phtml</template></action>
</reference>
<reference name="product_list">
<action method="setTemplate"><template>catalog/product/list_8.phtml</template></action>
</reference>
</CATEGORY_8>
I want create new layout and I want apply this layout for category.
I created new layout
<page_new_new module="page" translate="label">
<label>Layout new</label>
<template>page/category_8.phtml</template>
<layout_handle>page_new_new</layout_handle>
</page_new_new>
How I can setup templates for this layout?
I don't want using "Custom Layout Update" field inside admin.
I want use only "Page Layout" field?
I would insert the layout xml block (your first code part with CATEGORY_8) into design/frontend/*/*/layout/page.xml (your actual frontend design folder, most possibly default/default) and create an extension with a simple config.xml, something like this:
<?xml version="1.0"?>
<config>
<global>
<page>
<layouts>
<page_new_new module="page" translate="label">
<label>Layout new</label>
<template>page/category_8.phtml</template>
<layout_handle>page_new_new</layout_handle>
</page_new_new>
</layouts>
</page>
</global>
</config>
To create an extension just create the folder structure in your app/code/local directory:
YourCompanyName/ModuleNameYouLike/etc
and put this [config.xml] in, you will also need an xml file in app/etc/modules directory:
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<YourCompanyName_ModuleNameYouLike>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Page />
</depends>
</YourCompanyName_ModuleNameYouLike>
</modules>
</config>
After refreshing configuration and layout cache you will see Layout new for pages from the Page layout dropdown.