将顶部链接移动到Magento中的另一个块

时间:2014-09-11 23:42:33

标签: magento

我正在尝试将顶部链接移动到我在标题上方创建的静态块。目前,我只获得“退出”链接,而不是所有顶级链接(我的帐户,我的愿望清单,我的购物车和结帐)。如何将所有这些链接都放入静态块?

2columns-right.phtml

<head>
    <?php echo $this->getChildHtml('head') ?>
    </head>
    <body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
    <?php echo $this->getChildHtml('after_body_start') ?>
    <div class="wrapper">
        <?php echo $this->getChildHtml('global_notices') ?>
        <div class="page">
            <div><?php echo $this->getChildHtml('newreference') ?></div>
            <?php echo $this->getChildHtml('header') ?>
            <div class="main-container col2-right-layout">
                <div class="main">
                    <?php echo $this->getChildHtml('breadcrumbs') ?>
                    <div class="col-main">
                        <?php echo $this->getChildHtml('global_messages') ?>
                        <?php echo $this->getChildHtml('content') ?>
                    </div>
                    <div class="col-right sidebar"><?php echo $this->getChildHtml('right') ?></div>
                </div>
            </div>
            <?php echo $this->getChildHtml('footer') ?>
            <?php echo $this->getChildHtml('global_cookie_notice') ?>
            <?php echo $this->getChildHtml('before_body_end') ?>
        </div>
    </div>
    <?php echo $this->getAbsoluteFooter() ?>
    </body>
    </html>

newReference.phtml

<p class="welcome-msg"><?php echo $this->getChildHtml('welcome') ?> <?php echo $this->getAdditionalHtml() ?></p>
        <div class="quick-access">
            <?php echo $this->getChildHtml('topLinks') ?>
        </div>

那个local.xml

<?xml version="1.0" encoding="UTF-8"?>
    <layout>
        <default>
            <reference name="root">
                <block type="core/text_list" name="newreference" as="newreference" translate="label">
                    <label>New Reference</label>
                </block>
            </reference>
            <reference name="newreference">
                <block type="core/template" name="newreferenceblock" template="newreference.phtml">
                    <block type="page/template_links" name="top.links" as="topLinks"/>
                </block>
            </reference>
        </default>
    </layout>

1 个答案:

答案 0 :(得分:0)

试试这个

    <reference name="newreference">
        <block type="core/template" name="newreferenceblock" template="newreference.phtml">
            <block type="page/template_links" name="top.links" as="topLinks"/>
        </block>
   </reference>

将此更改为

<reference name="newreference">
    <block type="core/template" name="newreference" template="newReference.phtml">
        <block type="page/template_links" name="top.links" as="topLinks"/>
    </block>
</reference>