[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 346
  • Last Modified:

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

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
Andrew Angell
Asked:
Andrew Angell
  • 3
  • 2
2 Solutions
 
miked2004Commented:
is the right sidebar even showing?
0
 
Andrew AngellAuthor Commented:
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
 
miked2004Commented:
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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
Andrew AngellAuthor Commented:
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
 
Andrew AngellAuthor Commented:
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
 
Chris StanyonCommented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now