we use a custom template and try to add rwd template for mobile use.
We add an exception for the mobile devices but need now to use an different "home" cms for the rwd template.
Where can I define the cms which is used for the homepage?
I have tried to change the cms.xml
<reference name="content">
<block type="core/template" name="default_home_page" template="cms/default/homeown.phtml"/>
</reference>
and created the cms page homeown
please add your code under <cms_index_index> tag
<cms_index_index>
<reference name="content">
<block type="core/template" name="default_home_page" template="cms/default/homeown.phtml"/>
</reference>
</cms_index_index>
Related
This question is somehow related to my previous question. I want the "recently viewed" section to show the products which are recently viewed by my (as a visitor). So in that way, every visitor will see their recently viewed products in that section.
Does magento provide any default functionality for this feature or do I have to do it the way I referred in my previous question.
Yes magento has its default functionality
Goto app/design/frontend/default/(yourtheme)/tempalte/reports folder
If you cant see that folder in your theme, just copy it and save it to your theme folder
you can use the below code to display in layout files
<block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml" />
To call in CMS pages (homepage)
{{block type="reports/product_viewed" name="left.reports.product.viewed" template="reports/product_viewed.phtml"}}
To call in phtml file
<?php echo $this->getLayout()->createBlock('reports/product_viewed')->setTemplate('reports/product_viewed.phtml')->tohtml(); ?>
yes , you can by simply use this
<cms_index_index>
<reference name="content">
<block type="reports/product_viewed" name="home.reports.product.viewed" alias="product_viewed" template="reports/home_product_viewed.phtml" after="product_new">
<action method="addPriceBlockType">
<type>bundle</type>
<block>bundle/catalog_product_price</block>
<template>bundle/catalog/product/price.phtml</template>
</action>
</block>
</reference>
</cms_index_index>
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
I would like to add a CMS static block (basket_shipping_message) just above the available shipping methods in my Magento checkout. I can edit the phtml file but would rather do it via my local.xml file.
The following code doesen't seem to be working, any ideas?
<checkout_onepage_index>
<reference name="content">
<reference name="shipping_method">
<block type="cms/block" name="basket_shipping_message" before="available">
<action method="setBlockId"><block_id>basket_shipping_message</block_id></action>
</block>
</reference>
</reference>
</checkout_onepage_index>
Did you call in your phtml template getChildHtml('basket_shipping_message');? That should do it. Without that magento does not render the block
I want to add a login form to CMs page in Magento, I have tried adding this:
{{block type=”core/template” template=”customer/form/login.phtml”}}
in the content section of the CMS page, but its not working . Please help me.
This code finally wordked for me .
{{block type ="Mage_Customer_Block_Form_login" template="customer/form/login.phtml" }}
Open cms.xml in your theme and find the following
<reference name="content">
<block type=”cms/page” name=”cms_page”/>
</reference>
Replace it with this
<reference name="content">
<block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml"/>
<block type=”cms/page” name="cms_page"/>
</reference>
Then your code should work.
If your magento version less than 1.6 use the below code.
{{block type="customer/login" template="customer/form/login.phtml"}}
if your Magento version is 1.6 or greater
{{block type="customer/login" template="persistent/customer/form/login.phtml"}}
Try this:
{{block type="customer/form_login" name="customer_form_login_block" template="persistent/customer/form/login.phtml"}}
This is a way to do it without modifying any files:
Go into the Design tab
In "Custom Layout Update XML" add the following:
< reference name="content">
< block type="customer/form_login" name="customer_form_login" template="customer/form/login.phtml" after="-"/>
< /reference>
There you go. You can also do this in Categories.
Tested in Magento 1.8.1 (should work on most versions)
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.