[Skip to main content](#vessel-content)

#   Plugin not triggered

##

- **[marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")**
- [![marcmarc's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1529-marcmarc "View marcmarc's Profile") Topic Author
- [ Offline](/forum/user/1529-marcmarc)

Less More

- Posts: 74
- Thank you received: 7
-
-

2 years 8 months ago -  2 years 8 months ago [\#359740](#359740) by [marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")  *[Plugin not triggered](/forum/31-development/907895-plugin-not-triggered#359740 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.3 -- PHP version -- : 8.1.27  Hi, I'm writing a plugin and I'm stuck at a very basic step : the plugin is not triggered.  My plugin is &quot;discovered&quot; installed and enabled. It's inside the directory /plugins/hikashop/plgHikashopTest/  I've stripped the php file &quot;plgHikashopTest.php&quot; at the bare minimum as is :  the xml &quot;plgHikashopTest.xml&quot; is :  So if triggered when a product is created or updated it should, well… die. Nothing is triggered! Nothing die.  Any idea? Thanks")* was created by *[marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")*

-- HikaShop version -- : 5.0.3
-- Joomla version -- : 4.4.3
-- PHP version -- : 8.1.27

Hi,
I'm writing a plugin and I'm stuck at a very basic step : the plugin is not triggered.

My plugin is "discovered" installed and enabled.
It's inside the directory /plugins/hikashop/plgHikashopTest/

I've stripped the php file "plgHikashopTest.php" at the bare minimum as is : Code:

&lt;?php defined('_JEXEC') or die('Restricted access'); class plgHikashopTest extends JPlugin { public function __construct(&amp;$subject, $config) { parent::__construct($subject, $config); } public function onAfterProductCreate(&amp;$element, &amp;$status) { die(); } public function onAfterProductUpdate(&amp;$element, &amp;$status) { die(); } } ?&gt;

the xml "plgHikashopTest.xml" is :
Code:

&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;extension type="plugin" version="1.0.0" method="upgrade" group="hikashop"&gt; &lt;name&gt;plgHikashopTest&lt;/name&gt; &lt;creationDate&gt;mars 2024&lt;/creationDate&gt; &lt;version&gt;1.0.0&lt;/version&gt; &lt;author&gt;&lt;/author&gt; &lt;authorEmail&gt;&lt;/authorEmail&gt; &lt;authorUrl&gt;&lt;/authorUrl&gt; &lt;copyright&gt;&lt;/copyright&gt; &lt;license&gt;http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL&lt;/license&gt; &lt;description&gt;plgHikashopTest&lt;/description&gt; &lt;files&gt; &lt;filename plugin="plgHikashopTest"&gt;plgHikashopTest.php&lt;/filename&gt; &lt;/files&gt; &lt;params addpath="/components/com_hikaserial/params"&gt; &lt;/params&gt; &lt;config&gt; &lt;fields name="params" addfieldpath="/components/com_hikaserial/fields"&gt; &lt;/fields&gt; &lt;/config&gt; &lt;/extension&gt;

So if triggered when a product is created or updated it should, well… die.
Nothing is triggered! Nothing die.

Any idea?
Thanks

Last edit: 2 years 8 months ago by [marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwNzg5NS1wbHVnaW4tbm90LXRyaWdnZXJlZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86541
- Thank you received: 14304
-
-

2 years 8 months ago [\#359748](#359748) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Plugin not triggered](/forum/31-development/907895-plugin-not-triggered#359748 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.3 -- PHP version -- : 8.1.27  Hi, I'm writing a plugin and I'm stuck at a very basic step : the plugin is not triggered.  My plugin is &quot;discovered&quot; installed and enabled. It's inside the directory /plugins/hikashop/plgHikashopTest/  I've stripped the php file &quot;plgHikashopTest.php&quot; at the bare minimum as is :  the xml &quot;plgHikashopTest.xml&quot; is :  So if triggered when a product is created or updated it should, well… die. Nothing is triggered! Nothing die.  Any idea? Thanks")*

Hi,

The class of the plugin is not correct.
As per [ docs.joomla.org/Special:MyLanguage/J3.x:...\_a\_Plugin\_for\_Joomla](https://docs.joomla.org/Special:MyLanguage/J3.x:Creating_a_Plugin_for_Joomla) the class of the plugin needs to be plg&lt;PluginGroup&gt;&lt;PluginName&gt;
The &lt;PluginGroup&gt; in your case is "hikashop", and the &lt;PluginName&gt; in your case is plgHikashopTest so the class name should be:
plugHikashopPlgHikashopTest

I suppose you wanted the name of your plugin to be "test" so that the class name would be plgHikashopTest, but in that case, you need to rename your plugin files to test.php and test.xml and change the plugin name to "test" in your XML.

An easy way to find this is to move the die outside the class of the PHP file.
If the die is not called, then it means that the plugin PHP file is not called at all by PHP. So either the plugin is not enabled in the plugins manager or the file has a wrong filename.
If the die is called, then move the die in the __construct function which is called when the class is initialized. If the die is not called in the constructor function, then it can only be the class name which is wrong. If the die is called, then it means that the function name is wrong or the extension is not triggering the event for some reason.

That's basically what I do when I create a plugin and my event function is not being called ![:)](/media/kunena/emoticons/3.png ":)")

The following user(s) said Thank You: [marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwNzg5NS1wbHVnaW4tbm90LXRyaWdnZXJlZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")**
- [![marcmarc's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/1529-marcmarc "View marcmarc's Profile") Topic Author
- [ Offline](/forum/user/1529-marcmarc)

Less More

- Posts: 74
- Thank you received: 7
-
-

2 years 8 months ago [\#359763](#359763) by [marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")  Replied by *[marcmarc](/forum/user/1529-marcmarc "View marcmarc's Profile")* on topic *[Plugin not triggered](/forum/31-development/907895-plugin-not-triggered#359763 "-- HikaShop version -- : 5.0.3 -- Joomla version -- : 4.4.3 -- PHP version -- : 8.1.27  Hi, I'm writing a plugin and I'm stuck at a very basic step : the plugin is not triggered.  My plugin is &quot;discovered&quot; installed and enabled. It's inside the directory /plugins/hikashop/plgHikashopTest/  I've stripped the php file &quot;plgHikashopTest.php&quot; at the bare minimum as is :  the xml &quot;plgHikashopTest.xml&quot; is :  So if triggered when a product is created or updated it should, well… die. Nothing is triggered! Nothing die.  Any idea? Thanks")*

Guilty as charged, it's been a long time since I created a Joomla plugin and I forgot the name thing...
Thanks!

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwNzg5NS1wbHVnaW4tbm90LXRyaWdnZXJlZD90bXBsPW1hcmtkb3du) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.058 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
