【问题标题】:Moving toplinks to another block in Magento将顶部链接移动到 Magento 中的另一个块
【发布时间】:2014-09-12 11:04:14
【问题描述】:

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

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>

【问题讨论】:

    标签: magento


    【解决方案1】:

    试试这个

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

    【讨论】:

    • 当我这样做时,块完全消失了。
    • 当它消失时尝试退出;在 newReference.phtml 和 links.phtml 中?退出了吗?
    • 与“exit;”结果相同;在 newReference.phtml 和 links.phtml 中。当我这样做时,块完全消失了。
    • 这意味着 newReference.php 没有被调用。由于在 customer.xml 中定义了一个块,它只显示登录或注销按钮。尝试在 page.xml 中添加参考块代码。
    • 一个。之所以调用 newReference.phtml,是因为我已将代码添加到在网站上功能显示的页面中。湾。我已将参考代码块添加到 page.xml 中,但它仍然无法正常工作。还有什么想法吗?
    猜你喜欢
    • 1970-01-01
    • 2013-12-08
    • 2015-07-03
    • 1970-01-01
    • 2014-07-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多