?
Solved

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

Posted on 2012-08-26
11
Medium Priority
?
726 Views
Last Modified: 2012-08-27
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
Comment
Question by:rafique12
  • 6
  • 4
11 Comments
 
LVL 45

Expert Comment

by:Chris Stanyon
ID: 38336029
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
 
LVL 17

Expert Comment

by:nanharbison
ID: 38336090
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
 

Author Comment

by:rafique12
ID: 38336925
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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 45

Expert Comment

by:Chris Stanyon
ID: 38337032
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
 

Author Comment

by:rafique12
ID: 38337216
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
 

Author Comment

by:rafique12
ID: 38337224
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
 
LVL 45

Expert Comment

by:Chris Stanyon
ID: 38337302
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
 

Author Comment

by:rafique12
ID: 38337699
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
 

Author Comment

by:rafique12
ID: 38337714
Ooops!
<customer_account> <!--Just for the customer account pages -->
    <remove name="sidebar.Categories" /> <!--Remove a block -->
        </customer_account>      
    </default>

Open in new window

0
 
LVL 45

Accepted Solution

by:
Chris Stanyon earned 2000 total points
ID: 38338124
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
 

Author Closing Comment

by:rafique12
ID: 38338852
You Genius!
0

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.

Question has a verified solution.

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

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…
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
Suggested Courses
Course of the Month16 days, 3 hours left to enroll

850 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