• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 732
  • Last Modified:

Featured products sidebar showing in My account admin?!?!

Hi guys,

Got another problem here! I've created a custom module which displays featured products in the right sidebar of my Magento homepage. However, the sidebar is also on display inside the My Account page when a user logs in. I have been tryin to remove the featured product sidebar without taking out all of the My Account options that are displayed inside the admin area.

I could really do with som help guys as I am very very stuck!
0
rafique12
Asked:
rafique12
  • 6
  • 4
1 Solution
 
Chris StanyonCommented:
Hi,

You add and remove blocks using XML.

Somewhere in your layout files you will have created a block that adds your custom module to the 'right' block. If you added this under the <default> handle it will add it to all pages. You would then need to remove it from the pages you don't want to show it on.

To remove it from the customer account pages, you'll need something like this, preferably in your local.xml file.

<customer_account>
	<reference name="right">
		<remove name="name.of.your.custom.module" />
	</reference>
</customer_account>

Open in new window

0
 
nanharbisonCommented:
Isn't there a setting in Magento where you can choose which pages to show this module on? I haven't used Magento, but other CMS software allows this. And since this one isn't free, it should be a feature!
0
 
rafique12Author Commented:
Thankyou both for your assistance. I have tried the method sent by @ChrisStanyon but the featured product sidebar just won't budge.

The module is being instatiated by in the page.xml file:

 <!--<block type="core/text_list" name="left" as="left" translate="label">
                <label>Left Column</label>
            </block>-->

            <block type="core/text_list" name="left" as="left" translate="label">
                <label>Left Column</label>
                <block type="catalog/navigation" name="featured" template="navigation/sidebarCategories.phtml" />
            </block>

            <block type="core/messages" name="global_messages" as="global_messages"/>
            <block type="core/messages" name="messages" as="messages"/>

Open in new window


I've included what is directly above and below it.

I included you code in both the local.xml and customer.xml but the sidebar still shows... Very confusing.

 <customer_account>
    <reference name="left" as="left">
    <remove name="featured"/>
    </reference>
</customer_account>

Open in new window


As a side note its is actually a left sidebar!

Please help me guys!!!!
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
Chris StanyonCommented:
Hmm. Looks OK. You need to make sure you clear the magento cache, particularly the Layout cache.

You could also try it without a reference - it's not actually needed. Put this code in your local.xml file (in your theme/layout folder)

<customer_account>
    <remove name="featured" />
</customer_account>

Just as an aside - it would be best-practice to create the block from local.xml in the first place, rather than the page.xml file. In local.xml, create the block inside a reference to 'left' within the <default> handler

<reference name="left">
     <block type="catalog/navigation" name="featured" template="navigation/sidebarCategories.phtml" />
</reference>
0
 
rafique12Author Commented:
Thankyou for your quick response. I have discovered that the featured products left side bar is actually being called by this:
<block type="core/text_list" name="left" as="left" translate="label">
                <label>Left Column</label>
            </block>

Open in new window


and not this?!?!?
<reference name="left">
     <block type="catalog/navigation" name="featured" template="navigation/sidebarCategories.phtml" />
		</reference>

Open in new window


The plot thickens! I can't see how this is happening!
0
 
rafique12Author Commented:
BTW:

<block type="core/text_list" name="left" as="left" translate="label">
                <label>Left Column</label>
            </block>

Open in new window



Is coming from the page.xml file!
0
 
Chris StanyonCommented:
The following code from page.xml just creates a block called 'left' - it's a structural block and doesn't have any content. It's like a placeholder.

<block type="core/text_list" name="left" as="left" translate="label">
     <label>Left Column</label>
</block>

Open in new window

You then add content to it by referencing the structural block and creating a content block, like this, usually in your local.xml file:

<reference name="left">
     <block type="catalog/navigation" name="featured" template="navigation/sidebarCategories.phtml" />
</reference>

Open in new window

The structural building blocks are usually contained in the core layout files and don't need editing. Any new content blocks you want to add should be added in your local.xml file. So your local file might look something like this:

<default> <!-- The Default handle - applies to all Page -->
    <reference name="left"> <!-- Which structural block are we creating in -->
        <block type="catalog/navigation" name="featured" template="navigation/sidebarCategories.phtml" /> <!-- Create a new block -->
    </reference>
</default>

<customer_account> <!--Just for the customer account pages -->
    <remove name="featured" /> <!--Remove a block -->
</customer_account>

Open in new window

0
 
rafique12Author Commented:
Thanks dude! It's not over yet though as I think we were referencing the wrong "name" i.e "featured" instead of "sidebar.Categories" I've made the change but it is getting is being removed 'Globally' from the front page and the My Account page...

<reference name="left">
     <block type="catalog/navigation" name="sidebar.Categories" template="catalog/navigation/sidebarCategories.phtml" />
		</reference>

Open in new window


And

<customer_account> <!--Just for the customer account pages -->
    <remove name="featured" /> <!--Remove a block -->
</customer_account>

Open in new window

0
 
rafique12Author Commented:
Ooops!
<customer_account> <!--Just for the customer account pages -->
    <remove name="sidebar.Categories" /> <!--Remove a block -->
        </customer_account>      
    </default>

Open in new window

0
 
Chris StanyonCommented:
If it's being removed from all your pages, you are likely calling the <remove> function inside the <default> handler. In the previous post, you have a closing <default> AFTER the <customer_account> tag.

You local.xml should have something like the following - take note of the 2 separate handlers - <default> and <customer_account>:

<default> <!-- The Default handle - applies to all Page -->
    <reference name="left"> <!-- Which structural block are we creating in -->
        <block type="catalog/navigation" name="sidebar.Categories" template="catalog/navigation/sidebarCategories.phtml" /> <!-- Create a new block -->
    </reference>
</default>

<customer_account> <!--Just for the customer account pages -->
    <remove name="sidebar.Categories" /> <!--Remove a block -->
</customer_account>

Open in new window

0
 
rafique12Author Commented:
You Genius!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now