Google Analytics Stopped Working after Ungradation to Magento 1.7 - magento

Google Analytics stopped working as i upgrade the Magento 1.6 to Magento 1.7.
Really Stuck what to do, i have already
reference name="after_body_start">
<block type="googleanalytics/ga" name="google_analytics" as="google_analytics" template="googleanalytics/ga.phtml" />
</reference>
in my googleanalytics.xml
Not able to set it properly for Magento 1.7.

Add a tag template="googleanalytics/ga.phtml" in the layout/googleanalytics.xml
<layout version="0.1.0">
<!--
Default layout, loads most of the pages
-->
<default>
<!-- Mage_GoogleAnalytics -->
<reference name="after_body_start">
<block type="googleanalytics/ga"
name="google_analytics"
as="google_analytics"
template="googleanalytics/ga.phtml" />
</reference>
</default>
</layout>

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 set custom page title and description for sitemap pages

I am looking for a method to add custom page title and meta description to Magento defaults catalog/seo_sitemap/category/ & catalog/seo_sitemap/product/ pages.
I have done this before on the built-in contacts page by updating the contacts.xml file with:
<reference name="head">
   <action method="setDescription"><title>my description here</title></action>
<action method="setTitle"><title>My title here</title></action>
</reference>
This works absolutely fine. However, I currently do not know how I can apply this or a similar technique to the 2 pages I've outlined.
Do the same thing but apply it in the catalog.xml file. You could also set up a local.xml with the following:
<?xml version="1.0"?>
<layout version="0.1.0">
<catalog_seo_sitemap_category translate="label">
<reference name="head">
<action method="setDescription" module="catalog"><title>Custom description here</title></action>
<action method="setTitle" module="catalog"><title>Custom Site Map here</title></action>
</reference>
</catalog_seo_sitemap_category>
</layout>
You can apply the same method to catalog/seo_sitemap/product/

Magento Content below the Page

I am having trouble with Magento CE 1.7.0.2 displaying content of my custom block below the page. The block displays right on the page, but the content is copied below the page after the closing HTML tag.
The display layout plugin only shows my block referenced once, so I have no idea why this is happening. I'm using a default/custom package. Please help!!!!
My Layout, if it helps:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<remove name="store_language" />
<remove name="store_switcher"/>
<remove name="footer_links" />
</default>
<makeorder_index_index>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
<reference name="content">
<block type="makeorder/orderblock" output="toHtml" name="orderdispaly"
template="makeorder/orderdisplay.phtml"/>
</reference>
</makeorder_index_index>
</layout>
you should remove the output="toHtml" directive from your "makeorder/orderblock" block properties. What this does is basically says to display the contents of your block as soon as it's initialized - no matter where it should be placed. So it ends up rendered after the "root" block.

how to add shopping cart url under top links in magento through customer.xml

I tried a lot to add shopping cart url in magento
please show me how to add shopping cart url under top links in magento through customer.xml
i did in this way.
<default>
<!-- Mage_Customer -->
<reference name="top.links">
<action method="addLink" translate="label title" module="checkout"><label>Shopping Cart</label><url helper="checkout/getShoppingCartUrl"/><title>Shopping Cart</title><prepare/><urlParams/><position>10</position></action>
</reference>
</default>
Try this:
<default>
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCheckoutLink"></action>
</block>
</reference>
</default>

Resources