Renaming links from top menu using local.xml? - magento

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>
Eg: I want to rename My Cart, My Cart(1) to Current order, Current order(1) respectively.

You can find your translation files here "/app/locale/YOUR_LANGUAGE". To change the top links menu, you have to open "mage_checkout.csv".

Related

How do I add links to the top menu in Magento?

I want to modify the top level menu using code. I want it to a show list of pages in top level. How is it possible?
You can modify this file '\app\design\frontend\yourtheme\template\page\html\topmenu.phtml' and add custom code there to show list of pages.
`<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>

magento change block not working properly

I am using magento 1.7
on my product page I have added related product on right sidebar.
there are other block also displayed on sidebar these are
-related product
-recently viewed product
-mycart
-paypal logo
Now I want related product to get displayed after mycart and paypal logo, right now it is displayed on top of right bar
I have used before and after but that is not working.
These is my code
paypal.xml
<reference name="right">
<block type="paypal/logo" name="paypal.partner.right.logo" after="cart_sidebar" template="paypal/partner/logo.phtml"/>
</reference>
catalog.xml
<reference name="right">
<block type="catalog/product_list_related" name="catalog.product.related" after="paypal.partner.right.logo" template="catalog/product/list/related.phtml"/>
</reference>
checkout.xml
<reference name="right">
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">
<action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
<action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
<block type="core/text_list" name="cart_sidebar.extra_actions" as="extra_actions" translate="label" module="checkout">
<label>Shopping Cart Sidebar Extra Actions</label>
</block>
</block>
how can I put mycart and paypal logo on top of right bar.
First you need to create or update your local.xml file IF you do not have a local.xml file you can create one in
app->frontend->[Package Name]->[Theme Name]->layout->local.xml
Once this is created you can copy exactly what I have in this post into that file for a start of how to use one.
DO ALL UPDATES THROUGH A LOCAL.XML file not through catalog.xml or checkout.xml !! This will make upgrades significantly easier later down the road. Additionally, you will be able to quickly see all changes you have made to your site in one file. This way I can see what you are actually updating.
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<reference name="right">
<!-- <action method="unsetChild"><alias>catalog.product.related</alias></action> -->
<block type="catalog/product_list_related" name="catalog.product.related" after="-" template="catalog/product/list/related.phtml"/>
</reference>
</default>
</layout>
If you end up with two try uncommenting my action method.. I can't remember if you have to declare it in separate reference or within there because I didn't test this but give it a try

Add block using Custom Layout Updates to category

I am trying use the Custom Layout Update field of a category to add something to the left sidebar for just this category but can't quite get it to work. I had it working before so I know I can do it but then my client accidentally deleted the category.
This works, so I know I have the ability to add something - but I don't want a static block:
<reference name="left">
<block type="cms/block" name="Designer Sidebar" before="-">
<action method="setBlockId"><block_id>designer_sidebar</block_id></action>
</block>
</reference>
I want to include a phtml file from my theme folder and trying this, but can't get it to output anything:
<reference name="left">
<block type="cms/block" name="Designer Sidebar" before="-" template="catalog/category/view_sidebar.phtml" />
</reference>
<reference name="left">
<block type="core/template" name="Designer Sidebar" template="catalog/category/view_sidebar.phtml"/>
</reference>

Magento: <action method="unsetChild"> Not removing a block

I switch the display of Wishlist_Sidebar from right to left, using the following codes, but the sidebar remains in both right and left sidebar.
<reference name="right">
<action method="unsetChild"><name>wishlist_sidebar</name></action>
//.....
</reference>
<reference name="left">
<action method="insert"><blockName>wishlist_sidebar</blockName></action>
</reference>
How to fix this problem
I think the unsetChild function might operate using the alias (the as attribute rather than the name attribute. Try using...
<reference name="right">
<action method="unsetChild"><name>wishlist</name></action>
//.....
</reference>

Magento local.xml layout file - overriding <remove name="left"/>

Is there any way to override, or re-add something that was removed via it's xml layout, using local.xml?
I've made a theme that's all based on one page layout, 2columns-left. But a lot of pages, such as the sitemap, are set to use a 1column layout. So for example, in catalog.xml, we have:
<catalog_seo_sitemap translate="label">
<label>Catalog Seo Sitemap (Common)</label>
<remove name="right"/>
<remove name="left"/>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="page/template_container" name="seo.sitemap.container" template="catalog/seo/sitemap/container.phtml">
<block type="page/template_links" name="seo.sitemap.links" as="links" template="page/template/links.phtml"/>
<block type="page/html_pager" name="seo.sitemap.pager.top" as="pager_top" template="page/html/pager.phtml"/>
<block type="page/html_pager" name="seo.sitemap.pager.bottom" as="pager_bottom" template="page/html/pager.phtml"/>
</block>
</reference>
</catalog_seo_sitemap>
And in my local.xml, I can override the root template to use by adding:
<catalog_seo_sitemap>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>
</catalog_seo_sitemap>
So it's now showing the sitemap in a 2column left layout. But there's nothing in the left column, as the < remove name="left" /> has removed it. I hate that I have to override this whole catalog.xml just to remove that, as it's a pain then when they update to a new version, I need to update all these extra layout files too.
So, is there any way to fix that using my local.xml? I think for the default Magento themes, they should have everything set to use the 3column layout, as that way you're free to remove whatever you don't need, but it's all there by default, so all changes can be done in the local.xml file.
Out of the box there's no way to unremove a layout block that's been removed by a previous call to <remove />. '
However, there's enough eventing in the Layout system that you can implement this yourself. And by "yourself", I mean I've created an experimental extension that adds a <unremove /> tag to the XML Layout system's grammer.
This has been asked before but no conclusion was reached. You can create a replacement block in your local.xml but there is no guarantee the child blocks added to it will be done so after your local changes.
<catalog_seo_sitemap>
<reference name="root">
<action method="setTemplate"><template>page/2columns-left.phtml</template></action>
<block type="core/text_list" name="left" as="left" translate="label">
<label>Left Column</label>
</block> <!-- Copied from page.xml -->
<block type="core/text_list" name="right" as="right" translate="label">
<label>Right Column</label>
</block> <!-- Copied from page.xml -->
</reference>
</catalog_seo_sitemap>
I've managed to do this by just changing the blocks name when reading it. Seems that if you remove a block and re-add it with the same name the remove label will apply to all blocks of the same name. In my case it was removing a account navigation and adding to the header.
<remove name="customer_account_navigation" />
<block type="customer/account_navigation" name="customer_account_nav" as="accountNavigation" template="customer/account/navigation.phtml">

Resources