I Want to add some new functionality for magento address book page, I create a Form their, and want to add an action via function like Add New Address Form.

Step1. : I Create a new function in app/code/local/Mage/Customer/Block/Address/Edit.php

public function **getImpAddrURL**()
    return Mage::getUrl('customer/address/**importAddr**');

Step2. : Create a New function in Controller app/code/local/Mage/Customer/controllers/AddressController.php

public function importAddrAction()
    echo "Hello"; exit;

Step3. : Create a form in Address Book : frontend/theme/mytheme/template/customer/address/book.phtml

<form action="echo $this->getImpAddrURL() ?>">
My Other fields here

But When I click on submit button I have an URL Like :


And 404 Error.

Please Suggest how can I use this.

  • have you created controller for that? if yes please provide us config code and controller code – Murtuza Zabuawala Sep 20 '16 at 11:38
  • @MurtuzaZabuawala, No just use the default controller responsible for customer address and add new function their. – Yogita Sep 20 '16 at 12:03
  • you cannot rewrite the controller in local this way only work for block,helper and model – Qaisar Satti Sep 20 '16 at 12:23
  • @QaisarSatti, Can I achieve my solution using Observer of customer Module ? – Yogita Sep 20 '16 at 12:42
  • i will prefer custom controller will do the trick for you. follow this answer stackoverflow.com/questions/576908/… – Qaisar Satti Sep 20 '16 at 12:46

You can not copy any controller file in local folder. Instead of copy customer controller you can create same method

public function importAddrAction() { echo "Hello"; exit; }

in any of your custom controller. and return that controller url fron getUrl method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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