Solved

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

Posted on 2011-09-04
6
326 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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 
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 42

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

E-commerce is quite a gambling world, and you should never entrust your business to a lucky chance. In order to outrun your competitors in a race to attract as many customers as possible, you need to have a well thought-out strategy under your belt.…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

705 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

18 Experts available now in Live!

Get 1:1 Help Now