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

#   Hikashop plugin for onBefore... / onAfter... triggered functions

##

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

Less More

- Posts: 11
- Thank you received: 1
-
-

2 years 2 months ago -  2 years 2 months ago [\#362755](#362755) by [bobalbax](/forum/user/36128-bobalbax "View bobalbax's Profile")  *[Hikashop plugin for onBefore... / onAfter... triggered functions](/forum/31-development/908523-hikashop-plugin-for-onbefore-onafter-triggered-functions#362755 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 5 -- PHP version -- : 8 -- Browser(s) name and version -- : Chrome  Hello I've tried to create an hikashop plugin in hplugins/hikashop/checkGift/ but it seems doesn't work My xml File : checkGift.xml  my php file : checkGift.php  i will obtain a blanc page no with &quot;succes&quot; no ? Could you help me ? it's my first try of Plugin")* was created by *[bobalbax](/forum/user/36128-bobalbax "View bobalbax's Profile")*

-- HikaShop version -- : 5.1.0
-- Joomla version -- : 5
-- PHP version -- : 8
-- Browser(s) name and version -- : Chrome

Hello
I've tried to create an hikashop plugin in hplugins/hikashop/checkGift/ but it seems doesn't work
**My xml File : checkGift.xml**Code:

&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;extension type="plugin" version="2.5" method="upgrade" group="hikashop"&gt; &lt;name&gt;CheckGift&lt;/name&gt; &lt;creationDate&gt;19 aout 2024&lt;/creationDate&gt; &lt;version&gt;5.0.4&lt;/version&gt; &lt;author&gt;Bob&lt;/author&gt; &lt;authorEmail&gt;robert.bitoun@gmail.com&lt;/authorEmail&gt; &lt;authorUrl&gt;http://www.le-monde-sensible-massages.fr&lt;/authorUrl&gt; &lt;copyright&gt;(C) 2010-2024 LMS SOFTWARE. All rights reserved.&lt;/copyright&gt; &lt;license&gt;http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL&lt;/license&gt; &lt;description&gt;This plugin enables you to check a gift&lt;/description&gt; &lt;files&gt; &lt;filename plugin="checkGift"&gt;checkGift.php&lt;/filename&gt; &lt;/files&gt; &lt;/extension&gt;

**my php file : checkGift.php**Code:

&lt;?php /** * @package HikaShop for Joomla! * @version 5.0.4 * @author hikashop.com * @copyright (C) 2010-2024 HIKARI SOFTWARE. All rights reserved. * @license GNU/GPLv3 http://www.gnu.org/licenses/gpl-3.0.html */ defined('_JEXEC') or die('Restricted access'); ?&gt;&lt;?php class plgHikashopCheckGift extends JPlugin { public function onHikashopBeforeDisplayView(&amp;$view) { echo 'success'; exit; } }

i will obtain a blanc page no with "succes" no ?
Could you help me ? it's my first try of Plugin

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwODUyMy1oaWthc2hvcC1wbHVnaW4tZm9yLW9uYmVmb3JlLW9uYWZ0ZXItdHJpZ2dlcmVkLWZ1bmN0aW9ucz90bXBsPW1hcmtkb3du) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

2 years 2 months ago [\#362761](#362761) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Hikashop plugin for onBefore... / onAfter... triggered functions](/forum/31-development/908523-hikashop-plugin-for-onbefore-onafter-triggered-functions#362761 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 5 -- PHP version -- : 8 -- Browser(s) name and version -- : Chrome  Hello I've tried to create an hikashop plugin in hplugins/hikashop/checkGift/ but it seems doesn't work My xml File : checkGift.xml  my php file : checkGift.php  i will obtain a blanc page no with &quot;succes&quot; no ? Could you help me ? it's my first try of Plugin")*

Hi,

That sounds good. Did you enable the plugin in the Joomla plugins manager ?

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

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

Less More

- Posts: 11
- Thank you received: 1
-
-

2 years 2 months ago -  2 years 2 months ago [\#362765](#362765) by [bobalbax](/forum/user/36128-bobalbax "View bobalbax's Profile")  Replied by *[bobalbax](/forum/user/36128-bobalbax "View bobalbax's Profile")* on topic *[Hikashop plugin for onBefore... / onAfter... triggered functions](/forum/31-development/908523-hikashop-plugin-for-onbefore-onafter-triggered-functions#362765 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 5 -- PHP version -- : 8 -- Browser(s) name and version -- : Chrome  Hello I've tried to create an hikashop plugin in hplugins/hikashop/checkGift/ but it seems doesn't work My xml File : checkGift.xml  my php file : checkGift.php  i will obtain a blanc page no with &quot;succes&quot; no ? Could you help me ? it's my first try of Plugin")*

Thanks for you answer, but yes i did. This function should be called on front when the user is showing one product, isn't it ?

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

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwODUyMy1oaWthc2hvcC1wbHVnaW4tZm9yLW9uYmVmb3JlLW9uYWZ0ZXItdHJpZ2dlcmVkLWZ1bmN0aW9ucz90bXBsPW1hcmtkb3du) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

2 years 2 months ago [\#362767](#362767) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Hikashop plugin for onBefore... / onAfter... triggered functions](/forum/31-development/908523-hikashop-plugin-for-onbefore-onafter-triggered-functions#362767 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 5 -- PHP version -- : 8 -- Browser(s) name and version -- : Chrome  Hello I've tried to create an hikashop plugin in hplugins/hikashop/checkGift/ but it seems doesn't work My xml File : checkGift.xml  my php file : checkGift.php  i will obtain a blanc page no with &quot;succes&quot; no ? Could you help me ? it's my first try of Plugin")*

Hi,

This event is called almost everywhere HikaShop displays something on the frontend, so yes.

Move the echo / exit code outside of the class in your PHP file. That way, if you get success to appear it means that the file name is correct and the plugin is loaded and that either the class name is wrong or the event method name is wrong or the event is not called.
Then, you can add a constructor to your class with your echo / exit code in there. If it displays success, then it means that the class name is correct.

That's how I do it when I'm in the same situation and usually this helps me find the problem.

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

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

Less More

- Posts: 11
- Thank you received: 1
-
-

2 years 2 months ago [\#362790](#362790) by [bobalbax](/forum/user/36128-bobalbax "View bobalbax's Profile")  Replied by *[bobalbax](/forum/user/36128-bobalbax "View bobalbax's Profile")* on topic *[Hikashop plugin for onBefore... / onAfter... triggered functions](/forum/31-development/908523-hikashop-plugin-for-onbefore-onafter-triggered-functions#362790 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 5 -- PHP version -- : 8 -- Browser(s) name and version -- : Chrome  Hello I've tried to create an hikashop plugin in hplugins/hikashop/checkGift/ but it seems doesn't work My xml File : checkGift.xml  my php file : checkGift.php  i will obtain a blanc page no with &quot;succes&quot; no ? Could you help me ? it's my first try of Plugin")*

Thanks you for all
I rename the class and the files with "_" as check_gift instead of with camelcase ... and all is right !

Now, i notice, but i 've already noticed when the user return automatically or not (by a button purposed by paiement platform) to the website, is always disconneted - Please, how to fix that ?

Thans of lot
Bob

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwODUyMy1oaWthc2hvcC1wbHVnaW4tZm9yLW9uYmVmb3JlLW9uYWZ0ZXItdHJpZ2dlcmVkLWZ1bmN0aW9ucz90bXBsPW1hcmtkb3du) 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)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Offline](/forum/user/63-nicolas)

Less More

- Posts: 86290
- Thank you received: 14268
-
-

2 years 2 months ago [\#362793](#362793) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Hikashop plugin for onBefore... / onAfter... triggered functions](/forum/31-development/908523-hikashop-plugin-for-onbefore-onafter-triggered-functions#362793 "-- HikaShop version -- : 5.1.0 -- Joomla version -- : 5 -- PHP version -- : 8 -- Browser(s) name and version -- : Chrome  Hello I've tried to create an hikashop plugin in hplugins/hikashop/checkGift/ but it seems doesn't work My xml File : checkGift.xml  my php file : checkGift.php  i will obtain a blanc page no with &quot;succes&quot; no ? Could you help me ? it's my first try of Plugin")*

Hi,

Supposing that the user is logged in when the order is created (and it's not a guest checkout), then, it probably means that you have a product in the order with the "user group after purchase" setting configured, and that you have the "force logout" setting turned on in the HikaShop Group plugin, via the Joomla plugins manager.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzMxLWRldmVsb3BtZW50LzkwODUyMy1oaWthc2hvcC1wbHVnaW4tZm9yLW9uYmVmb3JlLW9uYWZ0ZXItdHJpZ2dlcmVkLWZ1bmN0aW9ucz90bXBsPW1hcmtkb3du) 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.170 seconds

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

[](#top)
