我正在构建我的第一个定制的Magento主题。这是缓慢的,但它正在进行。我摆脱了最初在主页上持有迷你搜索表单的酒吧,而是希望将搜索表单放在我的新标题中。
以下是header.phtml
中我的头的代码
<div id="header">
<a href="<?php echo $this->getUrl('') ?>" title="<?php echo $this->getLogoAlt() ?>" class="logo"><img src="<?php echo $this->getLogoSrc() ?>" alt="<?php echo $this->getLogoAlt() ?>" /></a>
<div id="header-top">
<?php echo $this->getChildHtml('topSearch') ?>
<?php echo $this->getChildHtml('topLinks') ?>
</div>
<?php echo $this->getChildHtml('topMenu') ?>
</div>
但是搜索表单没有呈现。以下是有关的网站:
http://s1.mynewsitereview.com/
非常感谢!
发布于 2013-10-20 00:59:19
我知道这个问题很老,但我会把我的答案发出来,希望它能帮助其他人解决同样的问题。
在我的例子中,我需要在我的页脚上另一个搜索表,所以我打开了
app/desing/frontend/base/default/layout/catalogsearch.xml
并复制:
<reference name="header">
<block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
</reference>
to:默认标记中的app/desing/frontend/my-theme/my-theme/layout/local.xml
<reference name="header">
<block type="core/template" name="top.search" as="topSearch" template="catalogsearch/form.mini.phtml"/>
</reference>
</default><!-- just to give a idea of the position of where you should paste this code -->
然后我把它改成:
<reference name="footer">
<block type="core/template" name="footer.search" as="footerSearch" template="catalogsearch/form.mini.phtml"/>
</reference>
</default>
然后在我的页脚文件中调用:
<?php echo $this->getChildHtml('footerSearch') ?>
基本上,您必须告诉您的主题需要在哪里使用本地xml获取“footerSearch”,然后可以将其称为thought。
https://stackoverflow.com/questions/12181827
复制相似问题