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.
-
You are getting 404 error because you may not have enabled the extension from the settings.Mohit Kumar Arora– Mohit Kumar Arora2018年07月24日 07:31:06 +00:00Commented Jul 24, 2018 at 7:31
-
I enabled the module from the settings. but not fill all the data. does it cause problem?Harshil Parekh– Harshil Parekh2018年07月24日 07:33:21 +00:00Commented Jul 24, 2018 at 7:33
-
1Yes, 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.Mohit Kumar Arora– Mohit Kumar Arora2018年07月24日 07:36:47 +00:00Commented Jul 24, 2018 at 7:36
1 Answer 1
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.
-
i enabled the extension and fill all the data but still goes to 404 on
constantcontact, but when i goes with/constantcontact/form/subscribethen i see result. but can you tell me why am I not able to see result usingconstantcontactURL.Harshil Parekh– Harshil Parekh2018年07月24日 08:40:49 +00:00Commented 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.Mohit Kumar Arora– Mohit Kumar Arora2018年07月24日 09:33:35 +00:00Commented Jul 24, 2018 at 9:33
Explore related questions
See similar questions with these tags.