【问题标题】:How can I display only My account link in top links in magento?如何在 magento 的顶部链接中仅显示我的帐户链接?
【发布时间】:2012-05-19 01:37:54
【问题描述】:

我已经在页脚中显示了所有链接,我只想在页眉中显示我的帐户链接

那我该怎么做。

我应该使用 cms 页面中的静态块还是 xml 文件中的块?

谁能帮帮我

提前致谢

【问题讨论】:

  • 要你添加我的账户部分的链接???

标签: magento header


【解决方案1】:

另一种添加“我的帐户”链接的方法 转到 app/design/frontend/default(或您的主题包)/(主题文件夹)/page/html/header.phtml。 在此文件中,您可以添加自定义的“li”标签,并可以在控制器将其移动到“我的帐户”页面时为“我的帐户”添加一个链接。

这里为您提供了另一种方式:)

打开 theme/layout/customer.xml 文件,然后修改在所有页面上显示客户链接的部分,以包含链接主页以及指向您认为必要的其他客户服务页面的链接,例如'returns'(如果你收到很多这样的询问......)。

<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>

享受:)

【讨论】:

    【解决方案2】:

    选项 1:

    布局文件用于在 top.links 块中显示链接。您可以在相关的 xml 文件中删除它们,并保留其他所有内容,例如在checkout.xml 你有类似的东西:

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

    如果您删除该块,那么它们将不再在 top.links 块中显示这两个链接。

    选项 2:

    正如您所说,另一种方法是创建一个 cms 块并将其包含在您的标题中。要在模板文件中包含 cms 块,您可以使用

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

    或者如果您想使用布局系统,请在布局文件中使用:

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

    然后在模板文件中:

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

    选项 3:

    或者只是编辑top.links.phtml

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-07
      • 1970-01-01
      • 2015-10-31
      • 1970-01-01
      相关资源
      最近更新 更多