0

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
</form>

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

http://*******/****/index.php/customer/address/importAddresses/

And 404 Error.

Please Suggest how can I use this.

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

1 Answer 1

1

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 and acknowledge that you have read and understand our privacy policy and code of conduct.

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