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

#   Limit all products to one per customer

##

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

Less More

- Posts: 324
- Thank you received: 4
-
-

2 years 10 months ago [\#357766](#357766) by [DogPeople](/forum/user/57755-dogpeople "View DogPeople's Profile")  *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#357766 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")* was created by *[DogPeople](/forum/user/57755-dogpeople "View DogPeople's Profile")*

Hi there,

Is there some way to limit ALL products to one per customer?

I am using calcbuilder to create "products" which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk_quantity=3;

Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?

I plan to create three leads for each calculation and then have contractors offering a service "claim" them in the backend. But I want to make them available to three separate companies.

Hope that makes sense!

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

Less More

- Posts: 86320
- Thank you received: 14276
-
-

2 years 10 months ago [\#357770](#357770) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#357770 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")*

Hi,

In the menu Products&gt;Limits, you can create limits on purchases. So you can configure a limit for a product so that each users won't be able to purchase that product more than once (it won't even work with different orders). The only solution for them would be to create several user accounts.
So I think it fits your needs.
The downside though is that you need to create one limit per product. Because if you create a limit for all the products, then the users will only be able to purchase a product once and not anymore after that.
You can read more about limits here:
[ www.hikashop.com/support/documentation/2...limits-tutorial.html](https://www.hikashop.com/support/documentation/293-filters-and-limits-tutorial.html)

So one solution would be to have a way to generate the limit in the hikashop_limit table each time a product is created. Supposing that Calcbuilder generates the products via the save function of class.product of HikaShop, then you can interface a mass action with an INSERT MySQL query to automatically create the entry in the hikashop_limit table. So it's quite simple, even without coding knowledge. Or maybe Calcbuilder offers some kind of PHP code execution capability where you could have it run the MySQL query for you ?

Otherwise, you could always create a plugin to interface with the add to cart process to check that the product being added to the cart by the current user is possible or not based on the previous orders of the user and if not, cancel the add to cart.
That's for example something we do in the 'cart reservation' plugin: [ www.hikashop.com/marketplace/product/208...art-reservation.html](https://www.hikashop.com/marketplace/product/208-checkout-cart-reservation.html)
In it, we check that the products being added to the cart are not already reserved by other users in their carts and if that's the case, we cancel the add to cart with the appropriate message. So it's the same mechanism, but with another condition.
Of course, in the case of a custom plugin, you have more leeway to have it work exactly the way you want, but it requires a PHP developer to work on it...

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

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

Less More

- Posts: 324
- Thank you received: 4
-
-

2 years 10 months ago [\#357796](#357796) by [DogPeople](/forum/user/57755-dogpeople "View DogPeople's Profile")  Replied by *[DogPeople](/forum/user/57755-dogpeople "View DogPeople's Profile")* on topic *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#357796 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")*

Hi again,

Okay, that sort of makes sense. So if I added the code

$hk_limit=1;

to the Calcbuilder code that creates the product after calculation, that should limit each product to 1 per customer?

Thanks!

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

Less More

- Posts: 86320
- Thank you received: 14276
-
-

2 years 10 months ago [\#357798](#357798) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#357798 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")*

Hi,

I don't know. What is $hk_limit ? Is it something from Calcbuilder ? I would recommend you check with Calcbuilder what they recommend as I don't know how it works at all.

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

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

Less More

- Posts: 324
- Thank you received: 4
-
-

2 years 10 months ago [\#357799](#357799) by [DogPeople](/forum/user/57755-dogpeople "View DogPeople's Profile")  Replied by *[DogPeople](/forum/user/57755-dogpeople "View DogPeople's Profile")* on topic *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#357799 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")*

Hi,

Sorry - that's my fault. I don't quite know how to figure out the names for these things.

I've attached a screenshot showing some of the PHP code that is creating the Hikashop products from Calcbuilder results.

So, for instance, it uses the code $hk_quantity to limit the quantity of each "product" to three.

I want to add a line of code that works on the "limit" you mentioned, and limit it to one. I tried just using $hk_limit, but since it doesn't work, I assume that's not right.

Instead of $hk_quantity, what would I start that line of code with to ensure that the quantity on the created product is limited to one?

- [ ![Screenshot2023-12-22at16-49-05CalculatorconfigurationExitLayoutResidentialChainLinkFence-FencePrice-Administration.png](/forum/attachment/58466) ](/forum/attachment/58466 "...nistration.png") [ ](/forum/attachment/58466?download=1 "...nistration.png")

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

Less More

- Posts: 86320
- Thank you received: 14276
-
-

2 years 10 months ago [\#357815](#357815) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#357815 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")*

Hi,

Ok.
You won't be able to create the limit in there.
To be able to create the limit, you need the product id. And in this code, you have yet to create the product, and thus, the product is not yet known.
As I said, the first thing is to check with the support of Calcbuilder to see what they recommend on how to proceed with this based on what I wrote previously.

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

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

Less More

- Posts: 198
- Thank you received: 4
-
-

2 years 5 months ago -  2 years 5 months ago [\#361277](#361277) by [arnask](/forum/user/6752-arnask "View arnask's Profile")  Replied by *[arnask](/forum/user/6752-arnask "View arnask's Profile")* on topic *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#361277 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")*

Nicolas, i'm using Products&gt;Limits to limit just one purchase per product for customer. So if customer wants to order another one same product, Hikashop cart notification plugin shows message for small time (defined in plugin) and disappears. So in my case user just sees that message for 1s and that's it. Is it possible to notify customer in different notification way in this case? Like the same way "The cart is empty" notification in bredcrumbs.

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

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

Less More

- Posts: 86320
- Thank you received: 14276
-
-

2 years 5 months ago [\#361282](#361282) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#361282 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")*

Hi,

There is no option for this. However, it's possible with some custom coding.
HikaShop provides javascript events, including cart.updated in order to process what the server-side returns after the user clicks on add to cart:
[ www.hikashop.com/support/documentation/6...ocumentation.html#js](https://www.hikashop.com/support/documentation/62-hikashop-developer-documentation.html#js)
The HikaShop cart notification plugin actually implements this event in order to display the notification box.
It is done in the file plugins/hikashop/cartnotify/media/notify.js
Also, since Joomla 4, it's possible to use javascript code to dynamically display error messages via the Joomla message system:
[ joomla.stackexchange.com/questions/20579...mla-using-javascript](https://joomla.stackexchange.com/questions/20579/how-to-display-message-in-joomla-using-javascript)
So, if you're a developer, you can combine all this to add your own error messages to the pages as needed.

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

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

Less More

- Posts: 198
- Thank you received: 4
-
-

2 years 5 months ago [\#361326](#361326) by [arnask](/forum/user/6752-arnask "View arnask's Profile")  Replied by *[arnask](/forum/user/6752-arnask "View arnask's Profile")* on topic *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#361326 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")*

unfortunately i'm not developer, so its impossible for me to notify customer in descent way ![:(](/media/kunena/emoticons/22.png ":(")

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

Less More

- Posts: 86320
- Thank you received: 14276
-
-

2 years 5 months ago [\#361328](#361328) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Limit all products to one per customer](/forum/32-content-creation/907498-limit-all-products-to-one-per-customer#361328 "Hi there,  Is there some way to limit ALL products to one per customer?  I am using calcbuilder to create &quot;products&quot; which are actually leads. There are three leads generated by default, based on the PHP code in the calculator, which is: $hk&#95;quantity=3;  Is there an option (either by means of a setting or by using PHP code on the calculator, to limit every lead to one per user?  I plan to create three leads for each calculation and then have contractors offering a service &quot;claim&quot; them in the backend. But I want to make them available to three separate companies.  Hope that makes sense!")*

Hi,

You could hire a developer to work on this for you.
If that's something you would like us to work on for you, you can request a quote via our contact form:
[ www.hikashop.com/support/contact-us.html](https://www.hikashop.com/support/contact-us.html)

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

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

[](#top)
