Remove recently viewed magento content - php

I'm trying to remove "recently viewed" from the home page, but I don't know where the block is called. I tried to delete reports.xml but the block stayed there. Then I tried to delete all the code in home_product_viewed.phtml and it worked, but I don't want to delete the code. I only want to delete the call to that file but I don't know where that file is called.

Goto magento backend.
Select the CMS page for homepage.
In the Design section add the below code in the Layout Update XML field
<reference name="right">
<action method="unsetChild"><alias>right.reports.product.viewed</alias></action>
</reference>

To remove it from only the home page, I would do this. Go to your /app/design/frontend/packagename/themename/layout/local.xml
and edit it like this:
<layout>
<cms_index_index>
<remove name="right.reports.product.viewed" />
</cms_index_index>
</layout>
To verify your packagname and themename, go in to admin - System - Configuration - Design.
There may already be other code inside of the layout tag which you should leave there!

This worked for me -> Using left below not right.reports.product.viewed.
Custom Layout Update
<reference name="right">
<action method="unsetChild"><alias>left.reports.product.viewed</alias></action>
</reference>

Related

Magento: Unable to show custom block

I followed this tutorial to create the custom block in magento
http://www.gravitywell.co.uk/blog/post/how-to-creating-your-own-custom-block-in-magento
But nothing is showed when I open up home page or any other page. I have searched alot on web but unable to solve the issue.
The above tutorial did not mention where to create layout.xml file but I have created it at:
app\design\frontend\gravitywell\example\layout\layout.xml ---It has just following code:
<block type="gravitywellexample/menu" name="menu" as="menu" template="gravitywell/menu.phtml" />
Any help will be highly appreciated.
Thanks in advance.
I would use local.xml, but then the question becomes what handle tags to put it inside of i.e. where do you want it to show up. When using a 2column-right layout, I can position it inside of the right column on the product page this way:
<catalog_product_view>
<reference name="right">
<block type="gravitywellexample/menu" name="menu" as="menu" template="gravitywell/example/menu.phtml" />
</reference>
</catalog_product_view>
my template is stored in a slightly different folder.
hth, sconnie

Move Cart to Header in Magento 1.7

I’m having trouble in moving the mini cart from sidebar to header. I’ve tried all the tutorials available in the internet but it doesn’t work.
I also tried adding this in the header block of layout\page.xml
<block type="checkout/cart_sidebar" name="cart_sidebar" as="topcart" template="checkout/cart/sidebar.phtml"
And then in my page\html\header.phtml, I use the code below to call the cart but nothing happened.
<?php echo $this->getChildHtml('topcart'); ?>
The solution above works in magento 1.6, but not in version 1.7
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.
The below example will add it to the header reference name which will be available on all pages as indicated by the tag and will only be available in the header.phtml file. Duplicate base/default/checkout/cart/sidebar.phtml and rebane that file as topcart.phtml and place it into your theme at [Your Package]/[Your Theme]/template/checkout/cart/topcart.phtml by doing this you are cloning the sidebar functionality and adding it to the header. Then you can make any edits through the topcart.phtml file without affecting base functionality.
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<reference name="header">
<block type="checkout/cart_sidebar" name="topcart_mini" as="topcart" template="checkout/cart/topcart.phtml" />
</reference>
</default>
</layout>
Then call it in header.phtml with
<?php echo $this->getChildHtml('topcart'); ?>
This is the proper way to modify Magento, this makes upgrades quite simple. Additionally, it does not edit any core files.
Insteat of copying block xml, you should reference it like
<reference name="block-name">
</reference>

Im trying to load phtml file via xml for added refund tab in magento?

Im trying to load an file sales/guest/form.phtml for added tab left navigation tab on customer my account, via customer.xml but didn't kindly help me.
Refund
I have done somewhat similar in my old project. here is what i do :
Added a new link in My Account section from customers.xml i.e
<action method="addLink" translate="label" module="preorder"><name>Previous_Orders</name><path>preorder/index/</path><label>Previous Orders</label></action>
In your case you can use an already running module instead of preorder and change the name in above action.
In module/contollers/IndexController.php add a view as follows :
public function viewAction()
{
$this->loadLayout();
$this->renderLayout();
}
Add preorder/preorder.phtml template folder in your theme template folder.
in your theme layout folder add preorder.xml as follows:
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
</default>
<preorder_index_index>
<label>Customer My Account Previous Orders</label>
<update handle="customer_account"/>
<reference name="content">
<block type="preorder/preorder" name="preorder" template="preorder/preorder.phtml" />
</reference>
</preorder_index_index>
</layout>
Hope you ot the idea, what we have done is created a new module which loads the template on index action, you cn change the name of module "preorder" and also the action "index" while working on this.
I was very brief while writing this, Hope this helps you in someway.

Pagination in Magento

I'm pretty new to Magento, and have been following the base theme so far along, but I am having problems with catalog pagination.
At the moment I'm having problems getting the "page/html_pager" block to display.
So, my catalog.xml has this for both anchor and non-anchor categories:
<reference name="content">
<block type="catalog/category_view" name="category.products" template="catalog/category/view.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.phtml">
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
<block type="page/html_pager" name="product_list_toolbar_pager" />
</block>
</block>
</block>
</reference>
My toolbar.phtml has the corresponding code:
<?php echo $this->getPagerHtml() ?>
and my default/template/page/html/pager.phtml just contains some test code along the lines of:
<h1>Test</h1>
At first I thought it might be because there weren't multiple pages, so I added some products and set the both the grid and the list views to show a maximum of 1 per page, and the item count reflects this:
Showing 1 of 11 items
Doing a var_dump on the $this->getPagerHtml() returns an empty string, and using the template path hints indicates it doesn't even seem to load the block - yet it loads it's parent block.
Copying the code directly from the base design package doesn't work, yet switching to that package it does.
So, what am I missing? Or doing wrong? I've run out of ideas as to what it could be.
thanks
Solved:
Adding<action method="setToolbarBlockName"><name>product_list_toolbar</name></action>
After the product_list_toolbar block appeared to fix this issue.
Magento's documentation is a little thin on the ground with this so I'm unsure as to why
<block type="catalog/product_list_toolbar" name="product_list_toolbar" template="catalog/product/list/toolbar.phtml">
requires it's name set again with an action tag, but it does.
If anyone can explain this, I'd love to understand it.
Any chance that it's being overridden by a different .xml file in layout?
You could always remove all the .xml files in the layout directory and bring them back in one by one and see if the pagination toolbar disappears, whilst making sure cache is turned off.
After that, rename the template directory catalog to ~catalog and let it pick up the base catalog directory and see if it's actually the .phtml files causing the problem.

customize the shopping cart page without affecting the original

I am developing a new custom module in magento. I need to customize the shopping cart page without affecting the original cart.phtml. My module name is Stallioni. I have placed the cart.phtml inside frontend/default/default/template/stallioni/checkout/cart.phtml .How can i use this cart.phtml in my new module instead of the original . I know we should change something in checkout.XML or stallioni/layout/stallioni.xml file. But no idea since i am new.I googled out a day but couldn't find.
http://blog.chapagain.com.np/magento-overriding-template-file-from-custom-module/ this link tells something but it didn't worked for me.I need your help!
If your layout.xml is working add this code in your layout
`<checkout_cart_index>
<reference name="content">
<reference name="checkout.cart">
<action method="setTemplate">
<template>default/default/template/stallioni/checkout/cart.phtml</template>
</action>
</reference>
</reference>
</checkout_cart_index>`
It should work :)

Categories