我在我的客户帐户信息中心添加了新的客户帐户导航链接,即password.phtml。我在这里看一些帖子,但我有点困惑,因为我是Magento的新人。下面是我的代码集。
创建/customer/account/password.phtml
我的模块是Don_Configs.xml
<config>
<modules>
<Don_Configs>
<active>true</active>
<codePool>local</codePool>
<version>0.1.0</version>
</Don_Configs>
</modules>
</config>
添加到local.xml
<customer_account translate="label">
<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>password</name>
<path>customer/password/</path>
<label>Password</label>
</action>
</block>
</reference>
</customer_account>
我的密码.php
<?php
class Don_Configs_Block_Password extends Mage_Core_Block_Template {
public function _prepareLayout()
{
return parent::_prepareLayout();
}
}
?>
我的PasswordController.php
<?php
class Don_Configs_PasswordController extends Mage_Core_Controller_Front_Action {
public function indexAction()
{
if(!Mage::getSingleton('customer/session')->isLoggedIn())
{
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account'));
return false;
}
$this->loadLayout();
$this->_initLayoutMessages('customer/session');
$this->getLayout()->getBlock('head')->setTitle($this->__('Update Password'));
$this->renderLayout();
}
}
?>
谢谢!
答案 0 :(得分:1)
尝试使用此
更新local.xml<customer_account>
<reference name="customer_account_navigation">
<action method="addLink" translate="label">
<name>password</name>
<path>customer/password/</path>
<label>Password</label>
</action>
</reference>
</customer_account>