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

#   Unique Coupon

##

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

Less More

- Posts: 3
- Thank you received: 0
-
-

14 years 10 months ago [\#33035](#33035) by [giboo](/forum/user/5130-giboo "View giboo's Profile")  *[Unique Coupon](/forum/2-general-talk-about-hikashop/33035-unique-coupon#33035 "Hello I just purchased business version, looking for extra restriction over coupons. Is it possible to create one coupon that any user can use a predefine time, and mostly only once ?  I try this code below, but it comes to conflict with the coupon removal process.  I'm sure you'll be able to implement this very easely :")* was created by *[giboo](/forum/user/5130-giboo "View giboo's Profile")*

Hello
I just purchased business version, looking for extra restriction over coupons.
Is it possible to create one coupon that any user can use a predefine time, and mostly only once ?

I try this code below, but it comes to conflict with the coupon removal process.

I'm sure you'll be able to implement this very easely :
Code:

function check_coupon(){ // restricted usage numbers $user=&amp;JFactory::getUser(); $db =&amp; JFactory::getDBO(); $coupon = JRequest::getString('coupon',''); if(!empty($coupon)){ $db-&gt;setQuery("SELECT COUNT(order_id) FROM #__hikashop_order AS o". " LEFT JOIN #__hikashop_user AS u ON o.order_user_id=u.user_id". " WHERE u.user_cms_id=".$user-&gt;id. " AND o.order_discount_code='".$coupon."'" ); $already = $db-&gt;loadResult(); // the number 1 below might be replaced with a parameter from the backend if ($already&gt;1){ $app =&amp; JFactory::getApplication(); $app-&gt;enqueueMessage(JText::_('COUPON_ALLREADY_USED')); return false; } else { return true ; } } else { return true; } }

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzMzMDM1LXVuaXF1ZS1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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: 86323
- Thank you received: 14282
-
-

14 years 10 months ago [\#33059](#33059) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Unique Coupon](/forum/2-general-talk-about-hikashop/33035-unique-coupon#33059 "Hello I just purchased business version, looking for extra restriction over coupons. Is it possible to create one coupon that any user can use a predefine time, and mostly only once ?  I try this code below, but it comes to conflict with the coupon removal process.  I'm sure you'll be able to implement this very easely :")*

Yes you can do that.
Just select an end date for the coupon and set a user quota of 1 in your coupon and that will do what you want. You don't have to change any code for that.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzMzMDM1LXVuaXF1ZS1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 3
- Thank you received: 0
-
-

14 years 10 months ago -  14 years 10 months ago [\#33074](#33074) by [giboo](/forum/user/5130-giboo "View giboo's Profile")  Replied by *[giboo](/forum/user/5130-giboo "View giboo's Profile")* on topic *[Re: Unique Coupon](/forum/2-general-talk-about-hikashop/33035-unique-coupon#33074 "Hello I just purchased business version, looking for extra restriction over coupons. Is it possible to create one coupon that any user can use a predefine time, and mostly only once ?  I try this code below, but it comes to conflict with the coupon removal process.  I'm sure you'll be able to implement this very easely :")*

Is the quota relative to client, or absolute ?
I mean I need the same coupon to be used once per user, not once for every users...

How does it work then ?

Thanks in advance ![:)](/media/kunena/emoticons/3.png ":)")

Last edit: 14 years 10 months ago by [giboo](/forum/user/5130-giboo "View giboo's Profile").

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzMzMDM1LXVuaXF1ZS1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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: 86323
- Thank you received: 14282
-
-

14 years 10 months ago [\#33083](#33083) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Re: Unique Coupon](/forum/2-general-talk-about-hikashop/33035-unique-coupon#33083 "Hello I just purchased business version, looking for extra restriction over coupons. Is it possible to create one coupon that any user can use a predefine time, and mostly only once ?  I try this code below, but it comes to conflict with the coupon removal process.  I'm sure you'll be able to implement this very easely :")*

If you look at the options of the coupon, both options exists: quota and quota per user.
So you can do both.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzMzMDM1LXVuaXF1ZS1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) to join the conversation.

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

Less More

- Posts: 3
- Thank you received: 0
-
-

14 years 10 months ago [\#33138](#33138) by [giboo](/forum/user/5130-giboo "View giboo's Profile")  Replied by *[giboo](/forum/user/5130-giboo "View giboo's Profile")* on topic *[Re: Unique Coupon](/forum/2-general-talk-about-hikashop/33035-unique-coupon#33138 "Hello I just purchased business version, looking for extra restriction over coupons. Is it possible to create one coupon that any user can use a predefine time, and mostly only once ?  I try this code below, but it comes to conflict with the coupon removal process.  I'm sure you'll be able to implement this very easely :")*

Thank you : I've been watching standard options for too long, and not enough business ones :laugh:

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzItZ2VuZXJhbC10YWxrLWFib3V0LWhpa2FzaG9wLzMzMDM1LXVuaXF1ZS1jb3Vwb24/dG1wbD1tYXJrZG93bg==) or [Create an account](/register) 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.072 seconds

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