简体   繁体   English

Magento呼叫帐户信息phtml块

[英]Magento call account information phtml block

We are making an other page on our website with the account information layout. 我们正在网站上制作另一个页面,其中包含帐户信息布局。
We wanted to call this block but we end up just having the h3 title: Account information. 我们想调用此块,但最终只得到h3标题:帐户信息。
We used this: 我们使用了这个:

{{block type="core/template" template="customer/account/dashboard.phtml"}}

Result: 结果:

http://i.imgur.com/Q17INWi.jpg

What we want: 我们想要什么:

http://i.imgur.com/RBCWKQj.png

Nevermind the categories! 没关系的类别!

Is there something we are doing wrong, well, obviously we are doing something wrong. 我们有做错什么吗,好吧,显然我们做错了什么。

Any more information needed? 需要更多信息吗? Feel free to ask! 随便问!

At first, you have to set the page template for this action in layout xml. 首先,您必须在布局xml中为此操作设置页面模板。

Like following: 如下所示:

<reference name="root">
    <action method="setTemplate"><template>page/2columns-left.phtml</template></action>
</reference>

And you put your block code to in <reference name="content"> ..... </reference> block. 然后将代码块放入<reference name="content"> ..... </reference>块中。

When you are outputting the {{block...}} declaration you are doing it in the content of the page, what you want to do is use the XML layout to insert your menu into the "left" block aka the left sidebar 当输出{{block ...}}声明时,是在页面内容中进行的,您要做的是使用XML布局将菜单插入“ left”块,也就是左侧边栏

In Design > Page Layout > Layout choose 2 column left sidebar, then paste this block in the XML section (remove the unnecessary links if you want): 在“设计”>“页面布局”>“布局”中,选择左侧两栏,然后将此块粘贴到XML部分中(如果需要,请删除不必要的链接):

<reference name="left">
    <block type="customer/account_navigation" name="customer_account_navigation" before="-" template="customer/account/navigation.phtml">
        <action method="addLink" translate="label" module="customer"><name>account</name><path>customer/account/</path><label>Account Dashboard</label></action>
        <action method="addLink" translate="label" module="customer"><name>account_edit</name><path>customer/account/edit/</path><label>Account Information</label></action>
        <action method="addLink" translate="label" module="customer"><name>address_book</name><path>customer/address/</path><label>Address Book</label></action>
        <action method="addLink" translate="label" module="downloadable"><name>downloadable_products</name><path>downloadable/customer/products</path><label>My Downloadable Products</label></action>
        <action method="addLink" translate="label" module="newsletter"><name>newsletter</name><path>newsletter/manage/</path><label>Newsletter Subscriptions</label></action>
        <action method="addLink" translate="label" module="oauth"> <name>OAuth Customer Tokens</name> <path>oauth/customer_token</path> <label>My Applications</label> </action>
        <action method="addLink" translate="label" module="review"><name>reviews</name><path>review/customer</path><label>My Product Reviews</label></action>
        <action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action>
        <action method="addLink" translate="label" module="tag"><name>tags</name><path>tag/customer/</path><label>My Tags</label></action>
        <action method="addLink" translate="label" module="wishlist" ifconfig="wishlist/general/active"><name>wishlist</name><path>wishlist/</path><label>My Wishlist</label></action>
    </block>
</reference>

This answer is a partial reference to this post with a bit of research by me on the extra blocks by magento 这个答案是对这篇文章的部分参考,我对magento的其他代码块做了一些研究

There are also limitations of this implementation as you cannot make this page secure. 由于无法确保此页面的安全性,因此此实现也有局限性。 As far as I know you will need to create a custom module for that, this article by @AlanStorm should help you out 据我所知,您需要为此创建一个自定义模块,@ AlanStorm的这篇文章应该可以为您提供帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM