News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Using the AJAX component of Joomla! VM is not loading the VM classes

Started by gba, December 17, 2021, 20:19:16 PM

Previous topic - Next topic

gba

Hello VM-Team!

VM v3.8.9 10473
Joomla!3.10.3

When I call a vmcustom plugin via AJAX call, the website crashes, because the VM classes (at least the vmCustomPlugin class) have not been loaded, yet.

A temporary workaround (by WDMtech support):
1. Add following code to the beginning of the custom plugin:
if (!class_exists('vmCustomPlugin')){
require(JPATH_ROOT .'/administrator/components/com_virtuemart/helpers/config.php');
if(class_exists('VmConfig')) VmConfig::loadConfig();
}

2. Place the custom plugin first before all other plugins of type 'vmcustom'.

It would be way better, if VM would load its classes itself on an AJAX call.
Has this been fixed in the latest version (v3.8.9 10514)?
If not, please fix that in the next VM version - thank you very much in advance!

Kind regards,
Gerald

Milbo

I wonder how you call the plugin?
If you use the vmextended onInitialise trigger, vm is loaded. If you use the view vmplg, vm is loaded. And of course systemplugins for example must load the vm api themselves
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

gba

Hi all!

I'd like to share the final solution of Max with you:
There is a system plugin called 'VM Framework Loader during Plugin Updates'.
If you enable the second setting ('Load config'), the VM classes are being loaded always and therefore are available on AJAX calls, too.

Thank you very much Max for that valuable hint!

Kind regards,
Gerald