I always get following error when calling $this->loadLayout() inside postAction() of my IndexController:
Fatal error: Class 'Mage_Package_MyModule_Helper_Data' not found in C:\xampp\apps\magento\htdocs\app\Mage.php on line 547
$this->renderLayout() doesn't give me an error.
IndexController:
class Package_MyModule_IndexController extends Mage_Core_Controller_Front_Action {
public function indexAction() {
$this->loadLayout();
$this->renderLayout();
}
public function testAction() {
$this->loadLayout();
$this->renderLayout();
}
public function postAction() {
$this->loadLayout();
$this->renderLayout();
//Mage_Core_Controller_Front_Action::loadLayout();
}
}
I also tried to call the method directly out of the class Mage_Core_Controller_Front_Action but it still gives me the same error. indexAction() and testAction() do work as expected.
config.xml:
<config>
<modules>
<Package_MyModule>
<version>0.3</version>
</Package_MyModule>
</modules>
<frontend>
<layout>
<updates>
<package_mymodule>
<file>mymodule.xml</file>
</package_mymodule>
</updates>
</layout>
<routers>
<mymodule>
<use>standard</use>
<args>
<module>Package_MyModule</module>
<frontName>mymodule</frontName>
</args>
</mymodule>
</routers>
</frontend>
<global>
<models>
<mymodule>
<class>Package_MyModule_Model</class>
</mymodule>
</models>
<helpers>
<mymodule>
<class>Package_MyModule_Helper</class>
</mymodule>
</helpers>
</global>
</config>
app/code/local/Package/MyModule/Helper/Data.php:
class Package_MyModule_Helper_Data extends Mage_Core_Helper_Abstract {
}
/layout/mymodule.xml
<layout version="0.1.0">
<mymodule_index_index>
<reference name="content">
<block type="core/template" name="default_mymodule_view" template="mymodule/view.phtml" />
</reference>
</mymodule_index_index>
</layout>
I think I got everything necessary at the right place. I have no idea why it isn't working inside postAction().
Mage
inMage_Package_MyModule_Helper_Data
line? Could you add your full config.xml?