爲了合併使用默認的登錄表單的客戶登記表的Magento,請注意以下步驟:
1.創建mini.register.phtml文件
首先,您需要創建一個新的模板文件:app/design/frontend/[your-interface]/[your-theme]/template/customer/form/mini.register.phtml
並將默認註冊文件的內容:app/design/frontend/base/default/template/customer/form/register.phtml
複製到mini.register.phtml並根據您的要求進行自定義。
2.包括mini.register.phtml在login.phtml
首先將文件複製:app/design/frontend/base/default/template/customer/form/login.phtml
到您當前的主題爲:
app/design/frontend/[your-interface]/[your-theme]/template/customer/form/login.phtml
,現在你需要修改新登錄。 phtml,以便您可以包含mini.register.phtml的內容。
對於這一點,你必須使用以下XML代碼在佈局xml文件(最好是在app/design/frontend/[your-interface]/[your-theme]/layout/local.xml
)爲:
<customer_account_login translate="label">
<reference name="content">
<action method="unsetChild"><child>customer_form_login</child></action>
<block type="customer/form_login" name="customer_form_login2" template="customer/form/login.phtml" >
<block type="customer/form_register" name="customer_form_register2" template="customer/form/mini.register.phtml">
<block type="page/html_wrapper" name="customer.form.register.fields.before" as="form_fields_before" />
</block>
</block>
</reference>
<reference name="head">
<action method="setTitle" translate="title" module="customer"><title>Login or Create an Account</title></action>
</reference>
</customer_account_login>
現在,你可以簡單地在您的新登錄的mini.register.phtml。PHTML文件:
<?php echo $this->getChildHtml('customer_form_register2'); ?>
- 大功告成。 現在清空緩存並重新加載客戶登錄頁面:
http://your-mage-store/customer/account/login
http://img137.imageshack.us/img137/2458/49833894.png – HeinekenBluess 2011-01-07 14:22:38