Hi,
There are three things you seem to be confused about:
- The folder of the plugin (or its type)
- The name of the plugin
- The event implemented by the plugin
With the call to JPluginHelper::importPlugin(); you need to provide the folder of the plugin. Usually, for a HikaShop plugin the folder is "hikashop". However, looking at the class name, it seems that you've chosen to use the "system" folder. In that case, you need to write "system" as parameter of that function call.
The code
$dispatcher=JDispatcher::getInstance();
$dispatcher->trigger();
is for Joomla 1.5, 2.5 and 3. It won't work on Joomla 4. Instead, you now need to use:
$app = JFactory::getApplication();
$app->triggerEvent();
This new code works on both J3 and J4 (and maybe even in J2.5).
The class name of a Joomla plugin should be:
plg + folder + name
So if your plugin's folder is "system", and its name is "custom", the class name should be:
plgSystemCustom
You need to use to camel case (
en.wikipedia.org/wiki/Camel_case#Current_usage_in_computing
) syntax (upper case for the first letter of the folder and of the name) or Joomla won't find the class of your plugin.
Now, a plugin normally has a XML file. And it's important the information in the XML correspond to the class name of the PHP file or it won't find the PHP file. As you didn't provide the XML file, I can't say if there is a problem in it.
Finally, the name of the files is also important (it should be the name of the plugin) and the plugin needs to be enabled in the joomla plugins manager.