我是Magento的新手,我带着一位在CMS配置/设计方面经验丰富的网页设计师的洞察力来解决这个问题。所以所有的布局xml的东西对我来说都很陌生。我只想将我的帐户、登录/注销和我的购物车链接添加到页脚。
这篇Magento论坛帖子描述了要使用什么代码以及从哪些文件复制和粘贴到什么文件,但是对于我的生活,我无法弄清楚页面中的确切位置.xml我应该放置各种addLink xml代码以使其显示在我的页脚中。
以下是来自客户.xml的"我的帐户"和"登录/注销"链接的 XML:
<!--
Default layout, loads most of the pages
-->
<default>
<!-- Mage_Customer -->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
</default>
<!--
Load this update on every page when customer is logged in
-->
<customer_logged_in>
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>100</position></action>
</reference>
</customer_logged_in>
<!--
Load this update on every page when customer is logged out
-->
<customer_logged_out>
<!---<reference name="right">
<block type="customer/form_login" name="customer_form_mini_login" before="-" template="customer/form/mini.login.phtml"/>
</reference>-->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>100</position></action>
</reference>
<remove name="reorder"></remove>
</customer_logged_out>
这是页面中的XML.xml论坛帖子说它应该去哪里,我不确定它应该放在哪一行:
<block type="page/html_footer" name="footer" as="footer" template="page/html/footer.phtml">
<block type="page/html_wrapper" name="bottom.container" as="bottomContainer" translate="label">
<label>Page Footer</label>
<action method="setElementClass"><value>bottom-container</value></action>
</block>
<block type="page/switch" name="store_language" as="store_language" template="page/switch/languages.phtml"/>
<block type="page/switch" name="store_switcher" as="store_switcher" template="page/switch/stores.phtml"/>
<block type="page/template_links" name="footer_links" as="footer_links" template="page/template/links.phtml"/>
</block>
这是来自footer.phtml的标记,链接应该结束:
<div class="four columns">
<?php echo $this->getChildHtml() ?>
</div>
我也很难理解getChildHtml如何提取页脚链接,知道从哪里获得这些链接。
任何帮助将不胜感激!我对Magento的力量感到兴奋,这让我大吃一惊,我怎么能花几个小时来完成一个看似简单的任务,比如在页脚上添加链接。
布兰登,在页脚中尝试以下代码
<?php echo $this->getChildHtml("footer_links") ?>
请尝试以下步骤。
默认情况下,magento使用"默认"主题,我假设您正在使用此主题。我建议不要更改页面.xml或洋红色的任何 xml 文件。
1.在app/design/frontend/default/default/layout
中创建local.xml
。
2.将以下代码添加到本地.xml文件
<?xml version="1.0"?>
<layout version="0.1.0">
<default>
<reference name="footer_links">
// This code it to remove the site map, search terms, advanced search, order and returns. Remove the below 4 lines if you want these in the footer.
<action method="removeLinkByUrl"><url helper="catalog/map/getCategoryUrl" /></action>
<action method="removeLinkByUrl"><url helper="catalogsearch/getSearchTermUrl" /></action>
<action method="removeLinkByUrl"><url helper="catalogsearch/getAdvancedSearchUrl" /></action>
<remove name="return_link" />
// to add my account link to footer links
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
// to add cart link
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
</block>
</reference>
</default>
<customer_logged_in>
<reference name="footer_links">
<action method="addLink" translate="label title" module="customer"><label>Log Out</label><url helper="customer/getLogoutUrl"/><title>Log Out</title><prepare/><urlParams/><position>20</position></action>
</reference>
</customer_logged_in>
<customer_logged_out>
<reference name="footer_links">
<action method="addLink" translate="label title" module="customer"><label>Log In</label><url helper="customer/getLoginUrl"/><title>Log In</title><prepare/><urlParams/><position>20</position></action>
</reference>
<remove name="reorder"></remove>
</customer_logged_out>
</layout>
3.To 删除"联系我们"转到"管理面板"System > Configuration > General > Contacts
,并将"启用联系我们"设置为否。
4.To 删除"关于我们"、"客户服务"和"隐私政策",请转到"管理"面板CMS > Static Blocks
禁用标题为"页脚链接"的块。
现在您应该在页脚中获取链接。如果您仍然没有得到链接,请按照Amit Bera的建议footer.phtml
文件中调用此<?php echo $this->getChildHtml("footer_links") ?>
注意:如果您使用的是自定义主题,请在app/design/frontend/your_package/your_theme/layout
中创建local.xml
文件