Domanda

I am trying to configure the customer account page for a 3column layout and I want to move the customer account navigation from its default position in the left column to the right column. So far I have tried this in the local.xml file of my own theme:

<customer_account_index>
    <reference name="root">
        <action method="setTemplate"><template>page/3columns.phtml</template></action>
    </reference>
    <reference name="left">
        <remove name="customer_account_navigation"/>
    </reference>
    <reference name="right">
        <block type="customer/account_navigation" name="customer_account_navigation" template="customer/account/navigation.phtml">
            <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
            <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
            <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
        </block>
    </reference>
</customer_account_index>

As expected, the customer account page will then have a 3 column layout and the customer account navigation is removed from the left column.

However, the navigation does not appear in the right column (any other block that is displayed by default in the right column is displayed as expected, so there is no general problem with the layout), and I am not sure why.

È stato utile?

Soluzione

The problem was, that I used

<reference name="left">
    <remove name="customer_account_navigation"/>
</reference>

to remove the customer account navigation from the left column. This is problematic, because those <remove> actions will be executed after all layout handles are merged (see https://stackoverflow.com/a/6358263/374996). Thus the solution was to change the removal to

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

And even better: instead of building a new block (with <block …>…) you can use

<reference name="right">
    <action method="insert">
        <name>customer_account_navigation</name>
    </action>
</reference>

to re-insert the existing block into the right column.

So all in all, to move a block, in this case the customer_account_navigation, from the left column to the right column for example, all you need is

<reference name="left">
    <action method="unsetChild">
        <name>customer_account_navigation</name>
    </action>
</reference>
<reference name="right">
    <action method="insert">
        <name>customer_account_navigation</name>
    </action>
</reference>

Altri suggerimenti

name="right" will work whenever your account pages's are layout 2-columns-right,3-columns.

You may be need to change to <reference name="content"> from <reference name="right">

Also,you need change handler to customer_account from customer_account_indexbecause of customer_account handler is call at all customer account page

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a magento.stackexchange
scroll top