how to display a text on right using magento - magento

I have written a code that displays a text hello world on right of the magento homepage, but however when I browse to other links like My Account, My WishList etc., it disappears. My question is how will I be able to display Hello World in every pages using reference name="right"?
<default>
<reference name="right">
<block type="core/template" name="catalog.helloworld" template="catalog/helloworld.phtml" />
</reference>
</default>
It works when I write reference name = "content".

The text is displayed where the block "right" is present, you can search your project for <remove name="right"/> and find where right block has been removed for the pages (my wishlist, myaccount, etc..)
Now you can enable this block by removing these tags, or (recommended) you can create your own block and add it to layout/page.xml

Related

How link a menu group in magento (via blocks/.phtml files)

I have created a mega menu group. but i stuck at relating it to file.
All i can see form a default one is
<block type="core/text_list" name="megamenu_left" as="megamenu_left" translate="label">
<label>Left Megamenu</label>
</block>
In Home page(Backend > Design Section):
<reference name="megamenu_left">
<block type="megamenu/list" name="megamenu.list.theme" as="megaMenuLeft" template="sm/megamenu/megamenu-left.phtml">
<action method="setConfig">
<values>
<group_id>2</group_id>
<theme>2</theme>
</values>
</action>
</block>
</reference>
And in home page Front view:
<?php echo $this->getChildHtml('megamenu_left') ?>
Things i didn't get is name="megamenu.list.theme" and how this is rendering.
EDITED
how is 'megamenu_left' from xml above is linked with a menu group i created on the backend. The menu group i created on backend just have a name and 'enable/disable' option.
I'm not sure if I understand the question correctly, but the second XML bit is going to look for the reference "megamenu_left" found in the first XML part, and insert the block at that position.
The block itself has the full name "megamenu.list.theme" in the layout, with the optional shortname "megaMenuLeft". It will render the template file "sm/megamenu/megamenu-left.phtml" which will be positioned in the active theme folder such as "app/design/frontend/theme/..".
The template will be using the PHP block from module "megamenu/Block/List.php" so any $this->functionName() calls or variables accessed from within the function comes from that block.
The frontpage will load the block by name from the first part of XML, which in turn will get the content from the second part XML since it's a reference, meaning it will insert itself in the first XML.

How to remove right sidebar in magento 1.9

I installed magento 1.9.
After installed widget and slieshow, my page look like this,
Here i want to remove recently viewed products and compare products.
So i removed in app/design/frontend/modern/layout/catalog.xml ,(these lines i removed)
<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
But still stays sidebar.
can anyone help me?
go to magento admin click on cms home page , click on design now select layout 1 column now save and refresh page
To remove from Home Page to to Admin panel CMS/PAGES/Home Page then go to Design Tab there the first option is Layout. Change it to 1 column. SO it will change the layout of (only )Home Page to one column without left and right.
<div class="MagicSlideshow" data-options="width: 400px; height:187px;">
use this code
I just had this same problem, and was able to remove the compare block using xml.
In my situation, I did not want change to a 1-column layout because of what I've already done with the right-col layout.
Solution:
Copy "catalog.xml" from /app/design/frontend/base/default/layout or /app/design/frontend/rwd/default/layout if you're using the new rwd theme.
Go to line 55 and remove or comment out the entire <reference name="right"> block:
<reference name="right">
<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
<!--<block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml">-->
<!--<action method="setImgSrc"><src>images/media/col_right_callout.jpg</src></action>-->
<!--<action method="setImgAlt" translate="alt" module="catalog"><alt>Keep your eyes open for our special Back to School items and save A LOT!</alt></action>-->
<!--</block>-->
</reference>
Go to line 178 (for rwd_default) or 165 (for base_default) and remove or comment out the <customer_account_index> block of code:
<customer_account_index>
<reference name="right">
<action method="unsetChild"><name>catalog.compare.sidebar</name></action>
</reference>
Save the file into your custom theme layout folder as "catalog.xml".
You can unset the compare side bar in the layout file of your theme. I added a new file in
/app/design/frontend/myTheme/layout/local.xml
where I unset the compare side bar using:
<?xml version="1.0" encoding="UTF-8"?>
<layout>
<default>
<action method="unsetChild"><name>catalog.compare.sidebar</name></action>
</default>
</layout>
Don't edit the default files as they will get overwritten on update.

Adding a block to magento category page using local.xml

Before posting this, i have looked in to the following, but all of them did not helped me and i was not able to add the block.
magento - adding and positioning a block using local.xml
Magento - Add phtml file to layout block
Magento 1.7:Show category image on category page in full width in a 2 column template
I want to add the category image on top of the page. Currently it is displayed under the product list view, and i want it to be above the left navigation, so that it takes full page width.
I created a template file in mytheme/template/catalog/category/image.phtml and i just added some text "I am here".
After that i add the following xml to my local.xml file under catalog_category_default
<reference name="content">
<block type="catalog/category_view" name="category.image" template="catalog/category/image.phtml"></block>
</reference>
But it is still not working and the text is not displayed there. When this text is displayed, then i will display the category image, but for now i just want to make the block working and display it on top of the page.
Thank you
Maybe your category does not load the layout handle catalog_category_default. There are 2 handles for categories _default and _layered.
To make sure you cover both cases and so you won't duplicate markup try this approach.
define your custom handle.
<my_awsome_category_handle>
<reference name="content">
<block type="catalog/category_view" name="category.image" template="catalog/category/image.phtml"></block>
</reference>
</my_awsome_category_handle>
Then include that handle in both category handles.
<catalog_category_default>
<update handle="my_awsome_category_handle" />
</catalog_category_default>
<catalog_category_layered>
<update handle="my_awsome_category_handle" />
</catalog_category_layered>

Modifying Magento layout for specific pages or extensions without impacting other pages

New to Magento here, looking for advice in making sure I modify the correct files to limit the scope of changes and not run into any issues when updating. I installed the following extension for FAQ function:
http://www.magentocommerce.com/magento-connect/flagbit-faq.html
By default the front end FAQ page was displaying with 2 columns (1 left sidebar showing a product comparison block which was unnecessary on a FAQ page). I found the following file:
/app/design/frontend/base/default/layout/faq.xml
And changed:
<default>
<reference name="root">
<action method="setTemplate"><template>page/page/2columns-left.phtml</template></action>
</reference>
</default>
To:
<default>
<reference name="root">
<action method="setTemplate"><template>page/1column.phtml</template></action>
</reference>
</default>
This had the desired result on the FAQ page, but also the undesired result of removing the compare box from the actual product list page. How would I best make the desired change to the FAQ page layout without impacting other pages?
Their module's faq.xml shouldn't be setting that on the default node.
Inspect the page and look for the class on body. It might be something like cms-faq (should say something about faq). Convert the dash - to an underscore _ and use that value in place of default in faq.xml
<cms_faq>
<reference name="root">
....
</cms_faq>
That should make sure the change to the setTemplate action only affects that page.
By setting default there, they are targeting all layout handles, which is really not what they should be doing in a module that just creates a new page.

Removing the block "Popular Tags" from the index view in Magento

I started working with Magento this week and I'm trying to create a new theme. Following the "Designing for Magento" article of the wiki, I tried to remove the Popular Tags block from the index view, adding this line to local.xml on magento\app\design\frontend\default\mytheme\layout:
<remove name="tags_popular"/>
I don't why, but the tags are still there while if I do the following the language switcher disappears:
<remove name="store_language"/>
I also tried this to no effect:
<reference name="left">
<action method="unsetChild"><name>tags_popular</name></action>
</reference>
I even deleted tag.xml and the tags are still there!
I know that I can get rid of them disabling the Mage_tag in the backend, buy I want to understand why this is not working.
Thanks!
Just add this in your theme->page.xml default block
<remove name="tags_popular"/>
you can remove block any of magneto. then you can remove after it's block name.
here you see tag_popular it's block name remove plus it's block name
Remove default magento block
Have a look into tag.xml where you will find this code, which you have to comment out:
<default>
<!-- Mage_Tag -->
<reference name="left">
<block type="tag/popular" name="tags_popular" template="tag/popular.phtm">
<action method="setTemplate"><template>tag/popular.phtml</template></action>
</block>
</reference>
</default>
How silly, the popular tags were shown in the main page because they came in the default code of the content page (menu: CMS > Pages), so I just had to erase that :P

Resources