Solved

Trouble working with Magento layout files to customize a theme...???

Posted on 2011-09-04
6
327 Views
Last Modified: 2013-11-18
I'm new to Magento and I'm trying to get a handle on working with layout files to customize the appearance of a page/theme.  

I'm currently working on http://magento.developersandbox.net, which is a clean install of 1.5.1 including sample data, and I've applied the Modern theme instead of the default one.

For practice, I'm simply trying to move the Popular Tags block from the left sidebar over to the right sidebar.  I turned on the template hints and it shows the following for the Popular Tags block:  frontend/base/default/template/tag/popular.phtml.

Based on what I've learned so far that tells me I need to working with the Tag module and layout file.  

As such, I opened up frontend/base/default/layout/tax.xml.  I can see the following chunk of XML that seems to be placing the block for me:

    <default>
        <!-- Mage_Tag -->
        <reference name="left">
            <block type="tag/popular" name="tags_popular" template="tag/popular.phtml"/>
        </reference>

    </default>

When I change reference name to "right", though, and then clear my Magento cache and reload the page, nothing changes.  The block still remains on the left side.

So then I think, ok, maybe I need to do this in my Modern theme since that's what I'm actually using.  So I change the original tag.xml back to the way it was (with reference left) and I opened up frontend/default/modern/layout/tag.xml.  I change this one to reference, right, and now it does indeed add the Popular Tags block to the right side, but it also leaves it on the left side so now I have it both places.

I can't seem to get a handle on this, but I feel like I'm close.  Any information on what I'm missing would be greatly appreciated.  Thanks!
0
Comment
Question by:Andrew Angell
  • 3
  • 2
6 Comments
 
LVL 12

Expert Comment

by:miked2004
ID: 36484638
is the right sidebar even showing?
0
 
LVL 11

Author Comment

by:Andrew Angell
ID: 36484653
Yes.  As it stands right now I'm back to the default theme in Magento.  I updated frontend/base/default/layout/tag.xml so that <reference name="left"> is now <reference name="right">.  

Just like before with the modern theme, the Popular Tags block shows up on the right when I make that change, but it still strands it on the left side, too.

I've done a site-wide find to see if some other module is adding the popular tags block on the left and it doesn't find it anywhere except for the default theme, the modern theme, and the iphone theme.  

I haven't tried the iphone theme specifically, but both default and modern are acting the same way, which is that when I adjust the tag.xml file to show "right" instead of "left" it does add it on the right, but leaves on the left as well.  If I set it back to "left" it removes it from the right but leaves it on the left.
0
 
LVL 12

Accepted Solution

by:
miked2004 earned 250 total points
ID: 36484690
well one way to fix this is to remove it from the left side.


<reference name="left">
			<action method="unsetChild"><name>tags_popular</name></action>
</reference>

Open in new window

0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 11

Author Comment

by:Andrew Angell
ID: 36484708
Yeah, that's not working either.  

I seem to have stumbled on another thread online where somebody  is the same problem:  http://stackoverflow.com/questions/2654515/removing-the-block-popular-tags-from-the-index-view-in-magento

They get the same answers at first, but then he responds with...

"How silly, the popular tags were shown in the main page because they came in the defualt code of the content page (menu: CMS > Pages), so I just had to erase that :P"

So I'm thinking I've got the same thing going on  here, but I'm not finding what he's referring to.  
0
 
LVL 11

Author Comment

by:Andrew Angell
ID: 36484716
Ah, ha!  I did find it and it was exactly what he said in that other thread.  Of course that's the one block I chose to try and play with after reading about layout files!
0
 
LVL 43

Assisted Solution

by:Chris Stanyon
Chris Stanyon earned 250 total points
ID: 36899411
Just as a heads up - you shouldn't edit files in the frontend/base folder - these are part of the core files and as soon as you update Magento, you'll overwrite any changes you made. If you need to edit these files, copy them to your theme folder and edit them there.

/frontend/your_theme/default/layout

What you tried to do in your original post (edit the tag.xml file and change left to right) is correct, but you are working on the wrong file. The files in the base folder are only used if they don't exist in your themes folder. The modern theme includes a layout override for the tags, so this is the one you need to edit.

Based on editing the files in your template folder, rather than the base folder, the file you need to edit is: frontend\default\modern\layout\tag.xml - simply change 'left' to 'right' in that file and you'll be good to go.

Hope that makes sense - I know Magento files can seem a little arcane when you first start out, but once the penny drops, things get easier :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

How important is it to take extra precautions to protect your online business? These are some steps you can take to make sure you're free of any cyber crime.
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now