Remove "my cart" from side bar in blog page only in magento - magento

I am trying to remove the "my cart" block from the blog page in magento, but i am not being able to remove only from the blog page. Whenever i try to remove it, it removes it from the whole website.
Is there a way to remove it from only the blog page?
The code that i used:
<reference name="right">
<remove name="cart_sidebar"/>
<block type="blog/menu_sidebar" name="right.blog.menu" >
<action method="setTemplate" ifconfig="blog/menu/right" ifvalue="1">
<template>aw_blog/menu.phtml</template>
</action>
<block type="blog/tags" name="blog_tags" />
</block>
</reference>
Any help will be appreciated, thank you

Related

Changing the columns on Magento's "Contact Us" page

Is there a simple way to change the column settings on Magento's "Contact Us" page through the CMS? It seems that by default the "Contact Us" page is not listed among the other CMS pages. Do I need to override the settings via XML?
Thank you for your help!
First, determine the "layout handle" for the contact page. For u i guess it is "contacts_index_index"
U can find this in file app/design/frontend/your-package/your-theme/layout/local.xml or contact.xml
<contacts_index_index translate="label">
<label>Contact Us Form</label>
<reference name="root">
<action method="setTemplate"><template>page/2columns-right.phtml</template></action>
<action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>
<reference name="content">
<block type="core/template" name="contactForm" template="contacts/form.phtml"/>
</reference>
</contacts_index_index>
Change the setTemplate call to reference your template
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
<action method="setHeaderTitle" translate="title" module="contacts"><title>Contact Us</title></action>
</reference>
Alternately, add the handle reference to your local.xml file. The local.xml file is applied last, so whatever goes in there "wins"
<layout>
<contacts_index_index>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</contacts_index_index>
</layout>
This is what worked for me:
Go to CMS > Manage Pages interface in the admin panel.
Create the contact page here and insert the following code:
<!– CONTACT FORM –>
{{block type="core/template" name="contactForm" form_action="/contacts/index/post" template="contacts/form.phtml"}}
<!– END OF CONTACT FORM –>
Click on the Design tab and change the layout to 1 column.

Hide discount code section in cart

I am writing a Magento Extension that is trying to hide the Discount Code section on the checkout cart page. I wrote the following code to replace the current cart.phtml with my custom template.
<layout version="0.1.0">
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setTemplate">
<template>company/module/cart.phtml</template>
</action>
</reference>
</checkout_cart_index>
</layout>
Everything looked good until I realized it even overwrote the template the cart page uses for an empty cart. I have tried many combinations for switch the "checkout_cart_index"
name to the reference name but I cannot get it to just replace that template. I further investigated and found in the default layout it sets the cart values here:
<reference name="content">
<block type="checkout/cart" name="checkout.cart">
<action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
I tried again using "SetCartTemplate" but I cannot get it to display yet alone behave as I am intending. Any ideas?
In your layout update
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setCartTemplate"><value>path/to/your/cart.phtml</value></action>
<action method="setEmptyTemplate"><value>path/to/your/noItems.phtml</value></action>
<action method="chooseTemplate"/>
</reference>
</checkout_cart_index>
chooseTemplate will choose the right template
Try to Rewrite this core class to hide the discount code section in your cart page
Mage_Sales_Model_Quote_Address_Total_Discount

Magento - local.xml not recognising customer_logged_out

I am using Magento 1.7.0.2 and would like to show some links only when the customer is logged out.
If I add the below code to local.xml nothing happens (I am logged out):
<customer_logged_out>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Test</label><url helper="customer/getLoginUrl"/><title>Test</title><prepare/><urlParams/><position>100</position></action>
</reference>
<remove name="reorder"></remove>
</customer_logged_out>
However as soon as I remove the customer_logged_out tags the link gets displayed (for everyone) ie:
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Test</label><url helper="customer/getLoginUrl"/><title>Test</title><prepare/><urlParams/><position>100</position></action>
</reference>
<remove name="reorder"></remove>
If I try to use customer_logged_in tags nothing gets displayed also.
Why are these logged_in/logged_out tags not working in local.xml?

How can I display only My account link in top links in magento?

I have displayed all links in footer and i want to display My account link only in header
So how can i do that.
Should i use static block from cms pages or block from xml file?
Can anyone please help me
Thanks in advance
Another way to add "My Account" link
goto app/design/frontend/default(or your theme package)/(theme folder)/page/html/header.phtml.
In this file you can add your custom 'li' tag and can put a link for "My Account" as Controller moves it to My Account PAGE.
One more way here for you :)
Open theme/layout/customer.xml file and then modify the section that shows customer links on all pages, to include a link home and also a link to other customer service pages that you have deemed necessary, e.g. ‘returns’ (if you get a lot of those enquiries...).
<default>
<!-- Mage_Customer -->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Home</label><url></url><title>Home</title><prepare>true</prepare><urlParams/><position>5</position></action>
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>94</position></action>
<action method="addLink" translate="label title" module="customer"><label>Deliveries</label><url>deliveries</url><title>Deliveries</title><prepare>true</prepare><urlParams/><position>95</position></action>
<action method="addLink" translate="label title" module="customer"><label>Returns</label><url>returns</url><title>Returns</title><prepare>true</prepare><urlParams/><position>96</position></action>
<action method="addLink" translate="label title" module="customer"><label>Contact Us</label><url>contacts</url><title>Contact Us</title><prepare>true</prepare><urlParams/><position>97</position></action>
</reference>
</default>
Enjoy :)
Option 1:
The layout files are used to display links in the top.links block. You can remove them in the relevant xml files, and leave everything else as is, e.g. in checkout.xml you have something like:
<default>
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
</default>
If you remove the block then they would no longer show these two links in the top.links block.
Option 2:
The alternative is, as you say, to create a cms block and include this in your header instead. To include a cms block in a template file you can use
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('toplinksblock')->toHtml() ?>
Or if you want to use the layout system use this in the layout file:
<reference name="footer">
<block type="cms/block" name="sample_links">
<action method="setBlockId"><block_id>sample_links</block_id></action>
</block>
</reference>
then this in the template file:
<?php echo $this->getChildHtml('sample_links') ?>
Option 3:
Or just edit top.links.phtml.

Add "My Cart" to top.links magento in local.xml or checkout.xml?

Two parts to this question:
How can I add My Cart to either local.xml or checkout.xml? I have a custom template, that never had it called. Looking for where it is being removed, but not sure I am looking in the right place.
I have tried adding to local.xml
<reference name="root">
<reference name="top.links">
<action method="addCartLink"></action>
</reference>
</reference>
But it breaks magento. Basically I have a soft add to cart and want to pull the default magento "My Cart" to the header, so the ajax updates on page like it does in the default magento template.
2nd par - Where does the code for "My Cart" live to tweak it?
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
</block>
</reference>
You may have to clear your cache.

Resources