I'm fairly new in Magento, what I'm trying to do is to get the request from URL and get the specific Parameter from it then pass it to Helper, in helper I need to check that specific parameter and run the correct function which is related to that specific parameter, Grateful if anyone can help me through this?
So, I already created my Controller file which is TestController.php
<?php
class Test_Request_TestController extends Mage_Core_Controller_Front_Action
{
public function indexAction()
{
$params = $this->getRequest()->getParams();
foreach ($params as $key => $value)
{
if($key == 'something')
{
echo Mage::helper('request')->getProducts();
}
}
}
}
and here is my config.xml
<?xml version='1.0'?>
<config>
<modules>
<Test_Request>
<version>0.0.1</version>
</Test_Request>
</modules>
<frontend>
<routers>
<Test>
<use>standard</use>
<args>
<module>Test_Request</module>
<frontName>Test</frontName>
</args>
</Test>
</routers>
</frontend>
<global>
<helpers>
<request>
<class>Test_Request_Helper</class>
</request>
</helpers>
</global>
</config>
and I've been created my helper
Data.php
<?php
class Test_Request_Helper_Data extends Mage_Core_Helper_Abstract
{
public function getProducts()
{
echo 'products';
}
}
What I did is, I created function in helper class and I want to check the parameters of the URL under controller if the parameter is the same as the thing I want I want to call the function from helper, is that right ?? because I keep getting this error:
Warning: include(/var/www/html/magento/includes/src/Test_Request_Helper_Data.php): failed to open stream: No such file or directory in /var/www/html/magento/includes/src/Varien_Autoload.php on line 93
#0 /var/www/html/magento/includes/src/Varien_Autoload.php(93): mageCoreErrorHandler(2, 'include(/var/ww...', '/var/www/html/m...', 93, Array)
#1 /var/www/html/magento/includes/src/Varien_Autoload.php(93): Varien_Autoload::autoload()
#2 [internal function]: Varien_Autoload->autoload('Test_Request_He...')
#3 /var/www/html/magento/app/Mage.php(547): spl_autoload_call('Test_Request_He...')
#4 /var/www/html/magento/app/code/community/Test/Request/controllers/TestController.php(12): Mage::helper('request')
#5 /var/www/html/magento/includes/src/__default.php(14015): Test_Request_TestController->indexAction()
#6 /var/www/html/magento/includes/src/__default.php(18399): Mage_Core_Controller_Varien_Action->dispatch('index')
#7 /var/www/html/magento/includes/src/__default.php(17933): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#8 /var/www/html/magento/includes/src/__default.php(20705): Mage_Core_Controller_Varien_Front->dispatch()
#9 /var/www/html/magento/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#10 /var/www/html/magento/index.php(87): Mage::run('', 'store')
#11 {main}
I really don't know where this coming from, Please let me know if you have any idea how to fix this issue, thanks :)