I'm trying to use Joomla's com_ajax for my module by using this url : index.php?option=com_ajax&module=MODNAME&method=MODMETHOD&format=json

However my helper.php file is located under folder modules/mod_modname/helper/ while joomla's com_ajax is always trying to find the helper file in modules/mod_modname/ so it returned error :

> {"success":false,"message":"The file at mod_modname\/helper.php does
> not exist.","messages":null,"data":null}

How can I tell the com_ajax the path of my helper.php file?


You can't.

The component looks for the helper like so:

$helperFile = JPATH_BASE . '/modules/mod_' . $module . '/helper.php';

where $module is the name of your module.

You will have to move the helper.php to modules/mod_modname

  • So how about with joomla 4's modules those are commonly placed the helper.php under /modules/mod_modname/src/Helper. Is it a bug or issue?
    – webchun
    Jan 24 '21 at 8:12
  • I've reported this issue anyway github.com/joomla/joomla-cms/issues/32136
    – webchun
    Jan 24 '21 at 14:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.