3

すべてのリンクをフッターに表示しましたが、アカウントのリンクをヘッダーにのみ表示したい

だからどうすればそれを行うことができますか。

cmsページの静的ブロックを使用する必要がありますか、それともxmlファイルのブロックを使用する必要がありますか?

誰か助けてくれませんか

前もって感謝します

4

2 に答える 2

4

Another way to add "My Account" link goto app/design/frontend/default(or your theme package)/(theme folder)/page/html/header.phtml. In this file you can add your custom 'li' tag and can put a link for "My Account" as Controller moves it to My Account PAGE.

One more way here for you :)

Open theme/layout/customer.xml file and then modify the section that shows customer links on all pages, to include a link home and also a link to other customer service pages that you have deemed necessary, e.g. ‘returns’ (if you get a lot of those enquiries...).

<default>

    <!-- Mage_Customer -->
    <reference name="top.links">
        <action method="addLink" translate="label title" module="customer"><label>Home</label><url></url><title>Home</title><prepare>true</prepare><urlParams/><position>5</position></action>
        <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>94</position></action>
        <action method="addLink" translate="label title" module="customer"><label>Deliveries</label><url>deliveries</url><title>Deliveries</title><prepare>true</prepare><urlParams/><position>95</position></action>
        <action method="addLink" translate="label title" module="customer"><label>Returns</label><url>returns</url><title>Returns</title><prepare>true</prepare><urlParams/><position>96</position></action>
        <action method="addLink" translate="label title" module="customer"><label>Contact Us</label><url>contacts</url><title>Contact Us</title><prepare>true</prepare><urlParams/><position>97</position></action>
    </reference>
</default>

Enjoy :)

于 2012-05-18T17:37:54.233 に答える
3

Option 1:

The layout files are used to display links in the top.links block. You can remove them in the relevant xml files, and leave everything else as is, e.g. in checkout.xml you have something like:

 <default>
    <reference name="top.links">
        <block type="checkout/links" name="checkout_cart_link">
            <action method="addCartLink"></action>
            <action method="addCheckoutLink"></action>
    </block>
    </reference>
</default>

If you remove the block then they would no longer show these two links in the top.links block.

Option 2:

The alternative is, as you say, to create a cms block and include this in your header instead. To include a cms block in a template file you can use

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('toplinksblock')->toHtml() ?>

Or if you want to use the layout system use this in the layout file:

<reference name="footer">
  <block type="cms/block" name="sample_links">
    <action method="setBlockId"><block_id>sample_links</block_id></action>
  </block>
</reference>

then this in the template file:

<?php echo $this->getChildHtml('sample_links') ?>

Option 3:

Or just edit top.links.phtml.

于 2012-05-18T14:01:00.673 に答える