0 Answers

Facing problem with contacts controller while overriding in Magento 1.6.2

Asked by: SamBaker 4303 views , , ,

So, I have made setup a brand new module to overrule the Contacts organizer to ensure that I’m able to give a newsletter registration choice to it. Following is the setup made by me:

Following is the code for IndexController.php:
# Controllers are not autoloaded so we will have to do it manually:
require_once ‘Mage/Contacts/controllers/IndexController.php’;
class MyNameSpace_ContactsPlus_Contacts_IndexController extends Mage_Contacts_IndexController
    # Overloaded indexAction
    public function indexAction() {
        # Just to make sure
        error_log(‘Yes, I did it!’);

Following is the code for config.xml:
<?xml version=”1.0″?>

Following is the code for MyNamespace_All.xml:
<?xml version=”1.0″?>

The module seems within the admin modules list and contains created the error as follows on my /contacts/ page:
Fatal error: Call to a member function setFormAction() on a non-object in /srv/www/ on line 54

Following is the line:
$this->getLayout()->getBlock(‘contactForm’)->setFormAction( Mage::getUrl(‘*/*/post’) );

I am unsure what to do came from here however, an estimate is it cannot set the method action on whatsoever has been the output from Mage::getUrl(‘//post’) but I am holding at straws tbh.

Any assistance of advice could be highly appreciated!

Answer Question