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

#   custom plugin for coupon

##

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

Less More

- Posts: 32
- Thank you received: 0
-
-

11 years 6 months ago -  11 years 6 months ago [\#199205](#199205) by [diesel1984](/forum/user/30999-diesel1984 "View diesel1984's Profile")  *[custom plugin for coupon](/forum/46-discount-coupon/876486-custom-plugin-for-coupon#199205 "-- HikaShop version -- : 2.2.3 -- Joomla version -- : 2.5.18 -- PHP version -- : 5  Hi,  I need to write a custom plugin for coupons. I have seen the &quot;developer documentation&quot; describing how to create a custom plugin and indeed i have written a custom plugin for hikashop before (albeit a long time ago). Ok so what i want to do is write a custom plugin for coupons - so im thinking of adding that custom plugin as follows:-  /plugins/hikashop/coupon/coupon.php  (for the above: is this the correct folder/file path for adding a coupon plugin?)  and then im thinking of adding code like so (to the coupon.php plugin file):-  Code: class plgHikashopCoupon extends JPlugin {   function plgHikashopCoupon(&amp;$subject, $config) {   parent::&#95;&#95;construct($subject, $config);   }  function onBeforeCouponLoad(&amp;$coupon,&amp;$do) {  }  }  (for the above: am i extending the right class? or should i be extending a more specific coupon class? Also is my constructor function correct?)  Thanks for the help in advance!")* was created by *[diesel1984](/forum/user/30999-diesel1984 "View diesel1984's Profile")*

-- HikaShop version -- : 2.2.3
-- Joomla version -- : 2.5.18
-- PHP version -- : 5

Hi,

I need to write a custom plugin for coupons. I have seen the "developer documentation" describing how to create a custom plugin and indeed i have written a custom plugin for hikashop before (albeit a long time ago). Ok so what i want to do is write a custom plugin for coupons - so im thinking of adding that custom plugin as follows:-

/plugins/hikashop/coupon/coupon.php

(for the above: is this the correct folder/file path for adding a coupon plugin?)

and then im thinking of adding code like so (to the coupon.php plugin file):-
Code:

class plgHikashopCoupon extends JPlugin { function plgHikashopCoupon(&amp;$subject, $config) { parent::__construct($subject, $config); } function onBeforeCouponLoad(&amp;$coupon,&amp;$do) { } }

(for the above: am i extending the right class? or should i be extending a more specific coupon class? Also is my constructor function correct?)

Thanks for the help in advance!

Last edit: 11 years 6 months ago by [diesel1984](/forum/user/30999-diesel1984 "View diesel1984's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ2LWRpc2NvdW50LWNvdXBvbi84NzY0ODYtY3VzdG9tLXBsdWdpbi1mb3ItY291cG9uP3RtcGw9bWFya2Rvd24=) 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: 86358
- Thank you received: 14289
-
-

11 years 6 months ago [\#199216](#199216) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[custom plugin for coupon](/forum/46-discount-coupon/876486-custom-plugin-for-coupon#199216 "-- HikaShop version -- : 2.2.3 -- Joomla version -- : 2.5.18 -- PHP version -- : 5  Hi,  I need to write a custom plugin for coupons. I have seen the &quot;developer documentation&quot; describing how to create a custom plugin and indeed i have written a custom plugin for hikashop before (albeit a long time ago). Ok so what i want to do is write a custom plugin for coupons - so im thinking of adding that custom plugin as follows:-  /plugins/hikashop/coupon/coupon.php  (for the above: is this the correct folder/file path for adding a coupon plugin?)  and then im thinking of adding code like so (to the coupon.php plugin file):-  Code: class plgHikashopCoupon extends JPlugin {   function plgHikashopCoupon(&amp;$subject, $config) {   parent::&#95;&#95;construct($subject, $config);   }  function onBeforeCouponLoad(&amp;$coupon,&amp;$do) {  }  }  (for the above: am i extending the right class? or should i be extending a more specific coupon class? Also is my constructor function correct?)  Thanks for the help in advance!")*

Hi,

That's correct so far.
Make sure that you also add the xml for your plugin and then zip both files and install the zip via the Joomla installer so that you can activate the plugin via the Joomla plugins manager.

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

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

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