Hello,
I have a custom-built search module where I want to use an existing component's model to fetch data. For that, I got this from the extension's module:When I use it in the module's main PHP file, I successfully get the model in $productsModel and $productIds.
However, the search module should use AJAX, and for that, I use com_ajax:In my helper, there is a function named searchdataAjax, and this should use the model as I mentioned above. But in the helper, $productsModel is empty.
Factory::getApplication()->bootComponent('com_customfilters')->getMVCFactory() returns a Joomla\CMS\MVC\Factory\LegacyFactory object, but createModel('CustomfiltersModelProducts') returns nothing. This only happens when I use com_ajax.
Do I need to load something else, or did I miss something?
I have a custom-built search module where I want to use an existing component's model to fetch data. For that, I got this from the extension's module:
Code:
$productsModel = Factory::getApplication()->bootComponent('com_customfilters')->getMVCFactory()->createModel('CustomfiltersModelProducts');$productIds = $productsModel->getProductIdsFromSearches();
However, the search module should use AJAX, and for that, I use com_ajax:
Code:
/index.php?option=com_ajax&module=my_ajax_search&format=json&method=searchdata&mysearchword=something&moduleid=135&language_tag=en-GB&showall=0
Factory::getApplication()->bootComponent('com_customfilters')->getMVCFactory() returns a Joomla\CMS\MVC\Factory\LegacyFactory object, but createModel('CustomfiltersModelProducts') returns nothing. This only happens when I use com_ajax.
Do I need to load something else, or did I miss something?
Statistics: Posted by sandomatyas — Thu Sep 19, 2024 11:04 am