0

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 <[email protected]>
 */
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.

3
  • You are getting 404 error because you may not have enabled the extension from the settings. Commented Jul 24, 2018 at 7:31
  • I enabled the module from the settings. but not fill all the data. does it cause problem? Commented Jul 24, 2018 at 7:33
  • 1
    Yes, since the extension requires Access key, access token, access secret, rate limit per day etc. to be configured, if you don't provide these values, the extension may not work. Commented Jul 24, 2018 at 7:36

1 Answer 1

2

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.

2
  • i enabled the extension and fill all the data but still goes to 404 on constantcontact , but when i goes with /constantcontact/form/subscribe then i see result. but can you tell me why am I not able to see result using constantcontact URL. Commented Jul 24, 2018 at 8:40
  • 1
    @H_Parekh, since the controller file is FormController.php, you will be able to see the result on /constantcontact/form URL for your index action. Commented Jul 24, 2018 at 9:33

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.