I have read quite many posts, but for me nothing is working. Task is quite simpe - I need to override core template review/product/view/list.phtml with my own, let's say my_list.phtml
My configuration is as follows. Layout.xml (head modification is working)
<layout version="0.1.0">
<review_product_list>
<reference name="head">
..
</reference>
<reference name="product.info">
<block type="review/product_view_list" name="myreview.product_additional_data"
as="myreview_product_additional_data" template="review/product/view/my_list.phtml"/>
</reference>
</review_product_list>
Config.xml
<frontend>
<layout>
<updates>
<myreview>
<file>myreview/layout.xml</file>
</myreview>
</updates>
</layout>
</frontend>
I can change core file review.xml and it works as expected, this line
<block type="review/product_view_list" name="product.info.product_additional_data" as="product_additional_data" template="review/product/view/list.phtml">
but this is not I am expecting.
If I change
reference name="product.info"
to
reference name="content" My template shows up, but not in place. If I try to debug, blocks are rendered.
<review_product_list>
<reference name="product.info.product_additional_data">
<action method="setTemplate">
<tpl>review/product/view/my_list.phtml</tpl>
</action>
</reference>
</review_product_list>
or
<review_product_list>
<action method="setTemplate" block="product.info.product_additional_data">
<tpl>review/product/view/my_list.phtml</tpl>
</action>
</review_product_list>
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.
In ShopShark(this module for blog) i have this code
<?xml version="1.0"?>
<layout version="0.1.0">
//a lot of code//
<blog_post_view>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="blog/post" name="post" template="blog/post.phtml">
<block type="blog/product_toolbar" name="blog_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager"/>
</block>
</block>
</reference>
</blog_post_view>
// a lot of code //
</layout>
Next i try to change post page. I found the solution here http://blog.chapagain.com.np/magento-overriding-template-file-from-custom-module/ , but its doesnt work! My code
<?xml version="1.0"?>
<layout version="0.1.0">
//a lot of code//
<blog_post_view>
<action method="setTitle">
<title>My Blog</title>
</action>
<reference name="post">
<action method="setTemplate">
<template>test/post.phtml</template>
</action>
</reference>
</blog_post_view>
// a lot of code //
</layout>
What you are exactly trying to do is not clear.I think you messed up with the structural block here. I am not exactly sure but needed to see the xml file where you have created the block "post".If you have not created the block "post",then you cannot use the code
<reference name="post">
From your code it seems that you are trying to change the template to post.phtml.
If that is the case than just change
<reference name="post">
to <reference name="content">
other part seem fine.
Hope this will help!
I've created a magento (1.7 CE) local module to add, in the Admin section, some info to the product list displayed in the Orders received.
Internally all seems to work good except that i'm not succeeding in replacing the template used to render each product line in the order.
In app/design/adminhtml/default/default/layout/sales.xml i have this code
<adminhtml_sales_order_view>
<reference name="head">
<action method="addJs"><file>mage/adminhtml/giftmessage.js</file></action>
<action method="addJs"><file>mage/adminhtml/giftoptions/tooltip.js</file></action>
</reference>
<reference name="content">
<block type="adminhtml/sales_order_view" name="sales_order_edit"></block>
</reference>
<reference name="left">
<block type="adminhtml/sales_order_view_tabs" name="sales_order_tabs">
<block type="adminhtml/sales_order_view_tab_info" name="order_tab_info" template="sales/order/view/tab/info.phtml">
<block type="adminhtml/sales_order_view_messages" name="order_messages"></block>
<block type="adminhtml/sales_order_view_info" name="order_info" template="sales/order/view/info.phtml"></block>
<block type="adminhtml/sales_order_view_items" name="order_items" template="sales/order/view/items.phtml">
<action method="addItemRender"><type>default</type><block>adminhtml/sales_order_view_items_renderer_default</block><template>sales/order/view/items/renderer/default.phtml</template></action>
<...
I would like to replace the template set by the LAST line you see (the addItemRenderer).
In my module config.xml i have
<adminhtml>
<layout>
<updates>
<my_ext>
<file>myext_update.xml</file>
</my_ext>
</updates>
</layout>
</adminhtml>
and in app/design/adminhtml/default/default/layout/myext_update.xml i have
<?xml version="1.0"?>
<admin_sales_order_view>
<reference name="left">
<reference name="sales_order_tabs">
<reference name="order_tab_info">
<reference name="order_items">
<action method="addItemRender">
<type>default</type>
<block>adminhtml/sales_order_view_items_renderer_default</block>
<template>myext/sales/order/view/items/renderer/default.phtml</template>
</action>
</reference>
</reference>
</reference>
</reference>
</admin_sales_order_view>
Obviously i have the file in app/design/adminhtml/default/default/template/myext/sales/order/view/items/renderer/default.phtml
but it is still not used.
Do you have a solution?
Found the solution after some day of struggling...
the code and the method is all good, but i mistyped the handle name to update in the myext_update.xml
i wrote
<admin_sales_order_view>
but , as in the original sales.xml, the handle name was
<adminhtml_sales_order_view>
Actually this wont work as the way you proceeded. You need to update the layouts.
Have some idea about layout updates also render the layout in yout module
Check here http://www.magentocommerce.com/design_guide/articles/intro-to-layouts
Hello I tried to remove the recent viewed product via local.xml, but it did not work and I don´t know why. Here my code:
<?xml version="1.0"?>
<reference name="right">
<action method="unsetChild"><alias>right.reports.product.viewed</alias></action>
<action method="unsetChild"><alias>right.reports.product.compared</alias></action>
</reference>
<default>
<action method="unsetChild"><name>right.reports.product.viewed</name></action>
<action method="unsetChild"><name>right.reports.product.compared</name></action>
<remove name="right.reports.product.viewed"/>
<remove name="right.reports.product.compared"/>
</default>
Does anyone know how I can remove links from the top menu using local.xml.
In the default checkout.xml there is:
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
And I would like to remove the addCartLink from the top menu. One way would be just edit the checkout.xml file, but it think it would be a much better solution just to add the remove to my local.xml file, but I can't seem to get the right name to remove. If I do a
<layout>
<default>
<remove name="top.links" />
</default>
</layout>
That does remove the entire menu, but how do I remove just a single item from the menu using locale.xml?
I am using Magento 1.6
You can do this in local.xml:
<default>
<reference name="top.links">
<action method="removeLinkByUrl">
<url helper="checkout/url/getCartUrl" />
</action>
</reference>
</default>
It was also my question How can i get the full path in local.xml file
<default>
<reference name="top.links">
<block type="wishlist/links" name="wishlist_link"/>
<action method="removeLinkBlock"><blockName>wishlist_link</blockName></action>
</reference>
</default>
Add this part to your local.xml. Writing this under default will remove it from every page. So adjust it accordingly. I hope this will help you.
It should be:
<layout>
<default>
<reference name="top.links">
<reference name="checkout_cart_link">
<remove name="top-link-cart" />
</reference>
</reference>
</default>
</layout>
But you can always copy the checkout.xml in your local theme and edit it.
<default>
<reference name="top.links">
<remove name="wishlist_link"/>
</reference>
</default>
Add this part to your local.xml. That works for me. Just use "remove". That's it.
You can remove a link via layout update either
by its name | calling removeLinkBlock($blockName)
by its url | calling removeLinkByUrl($url)
overwriting the file were it was added
The functions live in Mage_Page_Block_Template_Links
Option 1
The removeLinkByUrl() function needs an url as parameter which will usually provided by a helper function in the respective extension. Just grab it there and you can use something like
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getRegisterUrl"/></action>
</reference>
In above case customer is the extensions name while getRegisterUrl is the function in the helper class.
If your extension isn't providing any function which is returning a link you can try following
<reference name="top.links">
<action method="removeLinkByUrl"><url>ADD_THE_DYNAMIC_LINK_HERE</url></action>
</reference>
Option 2
If the link was added with a name, like
<reference name="top.links">
<block type="wishlist/links" name="wishlist_link" />
<action method="addLinkBlock"><blockName>wishlist_link</blockName></action>
</reference>
you can just use
<reference name="top.links">
<remove name="wishlist_link"/>
</reference>
or
<default>
<reference name="top.links">
<block type="wishlist/links" name="wishlist_link"/>
<action method="removeLinkBlock"><blockName>wishlist_link</blockName></action>
</reference>
</default>
Option 3
If your link wasn't added with a name and a hardcoded url doesn't work for some reason you can just go ahead and copy the modules layout.xml to your custom theme folder and remove the lines where the link was added.
Hi This removes both the cart and checkout links from top.links in 1.9.3
<reference name="top.links">
<action method="removeLinkByUrl">
<url helper="checkout/url/getCartUrl" />
</action>
<action method="removeLinkByUrl">
<url helper="checkout/url/getCheckoutUrl" />
</action>
</reference>
based on the best accepted answer above but just in case anyone wants to remove both