Question

I installed ExtetionsStore_ContactConstant from the GitHub. After installed I tried to go to frontcontroller url. but I am getting 404 error.

Here is my config.xml file code.

 <frontend>
        <routers>
            <extensions_store_constantcontact>
                <use>standard</use>
                <args>
                    <module>ExtensionsStore_ConstantContact</module>
                    <frontName>constantcontact</frontName>
                </args>
            </extensions_store_constantcontact>
        </routers>       
        <layout>
            <updates>
                <extensions_store_constantcontact module="ExtensionsStore_ConstantContact">
                    <file>extensions_store/constantcontact.xml</file>
                </extensions_store_constantcontact>
            </updates>
        </layout>     
    </frontend> 

Here is my controller file FormController.php

<?php

/**
 * ConstantContact form controller
 *
 * @category    ExtensionsStore
 * @package     ExtensionsStore_ConstantContact
 * @author      Extensions Store <admin@extensions-store.com>
 */
class ExtensionsStore_ConstantContact_FormController extends Mage_Core_Controller_Front_Action 
{
    public function indexAction() {
        echo 'Hello';exit;
    }
    protected function _initLayout()
    {
        $this->_initLayoutMessages('customer/session');   

        return $this;
    }

    /**
     * Get singleton model
     * @return ExtensionsStore_ConstantContact_Model_Constantcontact
     */
    protected function _getModel()
    {
        $model = Mage::getSingleton('extensions_store_constantcontact/constantcontact');

        return $model;
    }

    /**
     * Subscribe page
     */
    public function subscribeAction()
    {
        if ($this->_getModel()->isReady()){

            $this->loadLayout()->_initLayout()->renderLayout();

        } else {

            $this->norouteAction();
        }
    }

    /**
     *  Subscribe form action 
     * 
     */
    public function subscribePostAction()
    {
        if (!$this->_validateFormKey()) {
            $this->_redirect('*/*/subscribe');
            return;
        }

        if ($this->_getModel()->isReady() && $this->getRequest()->isPost()) {

            $data = $this->getRequest()->getPost();

            $result = $this->_getModel()->addUpdateContact($data);

            if ($result['error'] === false){

                Mage::getSingleton('customer/session')->addSuccess(Mage::helper('extensions_store_constantcontact')->__('We have received your information. Thank you for subscribing.'));

            } else {

                Mage::getSingleton('customer/session')->addError(Mage::helper('extensions_store_constantcontact')->__('There was an error processing your request. Please, try again later'));
            }

        } else {

            Mage::getSingleton('customer/session')->addError(Mage::helper('extensions_store_constantcontact')->__('There was an error processing your request. Please, try again later'));
        }

        $this->_redirect('*/*/subscribe');

    } 

}

also in module's readme file:

/constantcontact/form/subscribe URL for the use this extension...

can anyone tell me to solve this error.

Was it helpful?

Solution

The extension requires to be configured from the backend first before you start using it for the frontend.

There are many settings, without which the extension will not work.

The controller's subscribe action has the following code:

if ($this->_getModel()->isReady()){
    $this->loadLayout()->_initLayout()->renderLayout();
} else {
    $this->norouteAction();
}

which means if the model isReady() function returns false, then Magento will redirect to the 404 error page.

So, you need to first all the required settings to make the extension start working.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top