2

Is there a way to place a link (ie called Delete my account next to the Log out link in the Customer Navigation Account Dashboard?

I know there are paid extensions available for that but I'd like to know if it's possible by means of a simple module or via the local.xml?

1
  • have you got solution ?
    – Pawan
    Sep 21, 2017 at 17:55

1 Answer 1

3

app/design/frontend/{package}/{theme}/layout/local.xml

For the Customer account navigation :

<customer_account>
    <reference name="customer_account_navigation">
        <action method="addLink">
            <name>delete_my_account</name>
            <path>module/controller</path> //path to your controller function for deleting account
            <label>Delete my account</label>
        </action>
    </reference>
</customer_account>

EDIT:

The function in your controller

public function indexAction()
{
    $id = Mage::getSingleton('customer/session')->getCustomer()->getId‌​();
    $customer = Mage::getModel('customer/customer')->load($id);
    $customer->delete(); 
}
5
  • Hi. Thanks for your answer. Maybe a little bit dummy, but is there a way to find out that path to the controller function for deleting the customer account? Not really an expert in this matter. Sep 14, 2017 at 9:40
  • Would you please add the controller code to answer.
    – Neha Raval
    Sep 14, 2017 at 10:04
  • Please, look my update
    – PЯINCƎ
    Sep 14, 2017 at 12:31
  • Please, accept the answer if it has been helpful
    – PЯINCƎ
    Sep 16, 2017 at 1:53
  • Hello guys, this method seems to be quick and simple but still don't know what about controller. As there is in controller indexAction already, what to do with the code ? Where should I add this code to ? app/code/core/Mage/account/controllers/accountController.php ?
    – Rob D. A.
    May 21, 2018 at 7:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.