2014-03-31 54 views
0

我是Magento的新手,我在这方面与一位具有丰富配置/ CMS设计经验的网页设计师一起探讨。所以所有的布局xml东西对我来说都很陌生。我只是想添加“我的帐户”,“登录/注销”和“我的购物车”链接到页脚。如何通过Magento的page.xml调用页脚中的链接

This Magento论坛帖子描述了要使用哪些代码以及要复制和粘贴到哪些文件,但对于我的生活我无法弄清楚在page.xml中的确切位置我应该使用各种addLink xml代码来获取它在我的页脚展示。

下面是我的帐户和登录/注销链接的XML,从customer.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> 

这里是page.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的强大功能,它让我想起我如何在一个任务上花费几个小时,就像添加链接到页脚一样简单。

回答

0

布兰登,试试下面的代码在页脚

<?php echo $this->getChildHtml("footer_links") ?> 
0

尝试下面的步骤。

默认情况下,magento使用“默认”主题,我假设你使用这个主题。我建议不要更改page.xml或magento的任何xml文件。
1.在app/design/frontend/default/default/layout中创建local.xml

2.添加以下代码local.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.要删除关于我们,客户服务和隐私政策,请转至管理面板CMS > Static Blocks禁用标题为的页面页脚链接

现在你应该得到页脚的链接。 如果你仍然没有得到通过阿米特·贝拉的建议的链接调用此<?php echo $this->getChildHtml("footer_links") ?>footer.phtml文件

注:如果您正在使用自定义主题,然后在app/design/frontend/your_package/your_theme/layout

创建 local.xml文件
相关问题