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

#   Question and error with limits

##

- **[dustinjc](/forum/user/31466-dustinjc "View dustinjc's Profile")**
- [![dustinjc's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar31466.jpg)](/forum/user/31466-dustinjc "View dustinjc's Profile") Topic Author
- [ Offline](/forum/user/31466-dustinjc)

Less More

- Posts: 176
- Thank you received: 5
-
-

7 years 7 months ago [\#305431](#305431) by [dustinjc](/forum/user/31466-dustinjc "View dustinjc's Profile")  *[Question and error with limits](/forum/27-checkout/897249-question-and-error-with-limits#305431 "-- HikaShop version -- : 4.0.3 -- Joomla version -- : 3.9.4 -- PHP version -- : 7.0.33  I would like to set up a limit for a specific user group to have a spending monthly spending limit for several categories and sub-categories.  Specifically, a $400 monthly limit on all the categories and sub-categories of a vendor (we are using HikaMarket). This would reset to $400 each month.  Few Questions:  1) Can this be done with Limits? 2) Is there a way the user can check how much of their Limit 'balance' they have used / how much is left for the month? 3) Is there a different/better way you would suggest accomplishing this functionality? (we are also using AWOcoupon on this website)  Also, when trying to set up a test Limit in Hikashop, I believe I ran into a bug.  Here are the steps I followed to produce the issue:  1) Hikashop &gt; Products &gt; Limit &gt; New 2) &quot;Type&quot; defaults to &quot;Quantity&quot;. As soon as I try changing the &quot;Type&quot; to &quot;Price&quot; or &quot;Weight&quot; the page refreshes and goes back to the Hikashop &gt; Products &gt; Limit page list. As a result, I cannot save any Limits unless they are set to Type: Quantity.  Please advise.  Thank you, Dustin")* was created by *[dustinjc](/forum/user/31466-dustinjc "View dustinjc's Profile")*

-- HikaShop version -- : 4.0.3
-- Joomla version -- : 3.9.4
-- PHP version -- : 7.0.33

I would like to set up a limit for a specific user group to have a spending monthly spending limit for several categories and sub-categories.

Specifically, a $400 monthly limit on all the categories and sub-categories of a vendor (we are using HikaMarket). This would reset to $400 each month.

Few Questions:

1) Can this be done with Limits?
2) Is there a way the user can check how much of their Limit 'balance' they have used / how much is left for the month?
3) Is there a different/better way you would suggest accomplishing this functionality? (we are also using AWOcoupon on this website)

Also, when trying to set up a test Limit in Hikashop, I believe I ran into a bug.

Here are the steps I followed to produce the issue:

1) Hikashop &gt; Products &gt; Limit &gt; New
2) "Type" defaults to "Quantity". As soon as I try changing the "Type" to "Price" or "Weight" the page refreshes and goes back to the Hikashop &gt; Products &gt; Limit page list. As a result, I cannot save any Limits unless they are set to Type: Quantity.

Please advise.

Thank you,
Dustin

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NzI0OS1xdWVzdGlvbi1hbmQtZXJyb3Itd2l0aC1saW1pdHM/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14326
-
-

7 years 7 months ago [\#305447](#305447) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Question and error with limits](/forum/27-checkout/897249-question-and-error-with-limits#305447 "-- HikaShop version -- : 4.0.3 -- Joomla version -- : 3.9.4 -- PHP version -- : 7.0.33  I would like to set up a limit for a specific user group to have a spending monthly spending limit for several categories and sub-categories.  Specifically, a $400 monthly limit on all the categories and sub-categories of a vendor (we are using HikaMarket). This would reset to $400 each month.  Few Questions:  1) Can this be done with Limits? 2) Is there a way the user can check how much of their Limit 'balance' they have used / how much is left for the month? 3) Is there a different/better way you would suggest accomplishing this functionality? (we are also using AWOcoupon on this website)  Also, when trying to set up a test Limit in Hikashop, I believe I ran into a bug.  Here are the steps I followed to produce the issue:  1) Hikashop &gt; Products &gt; Limit &gt; New 2) &quot;Type&quot; defaults to &quot;Quantity&quot;. As soon as I try changing the &quot;Type&quot; to &quot;Price&quot; or &quot;Weight&quot; the page refreshes and goes back to the Hikashop &gt; Products &gt; Limit page list. As a result, I cannot save any Limits unless they are set to Type: Quantity.  Please advise.  Thank you, Dustin")*

Hi,

1. Yes, this should be possible with limits.

2. There is no such capability. The limit system is only used to check the cart load and add to cart processes. That would require some development to be able to add such display, for example on the user control panel.

3. No, I think that the limit feature is the only way to achieve this unless you want to do some development.

4. Thank you for your feedback. There is indeed a bug here. You would have to save first the limit as "quantity" type and then you would be able to change its type the way it is done now. I've added a patch on our end for that. So you can download the install package on our website and install it on yours to get the patch for that problem.

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

- **[dustinjc](/forum/user/31466-dustinjc "View dustinjc's Profile")**
- [![dustinjc's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar31466.jpg)](/forum/user/31466-dustinjc "View dustinjc's Profile") Topic Author
- [ Offline](/forum/user/31466-dustinjc)

Less More

- Posts: 176
- Thank you received: 5
-
-

7 years 7 months ago [\#305462](#305462) by [dustinjc](/forum/user/31466-dustinjc "View dustinjc's Profile")  Replied by *[dustinjc](/forum/user/31466-dustinjc "View dustinjc's Profile")* on topic *[Question and error with limits](/forum/27-checkout/897249-question-and-error-with-limits#305462 "-- HikaShop version -- : 4.0.3 -- Joomla version -- : 3.9.4 -- PHP version -- : 7.0.33  I would like to set up a limit for a specific user group to have a spending monthly spending limit for several categories and sub-categories.  Specifically, a $400 monthly limit on all the categories and sub-categories of a vendor (we are using HikaMarket). This would reset to $400 each month.  Few Questions:  1) Can this be done with Limits? 2) Is there a way the user can check how much of their Limit 'balance' they have used / how much is left for the month? 3) Is there a different/better way you would suggest accomplishing this functionality? (we are also using AWOcoupon on this website)  Also, when trying to set up a test Limit in Hikashop, I believe I ran into a bug.  Here are the steps I followed to produce the issue:  1) Hikashop &gt; Products &gt; Limit &gt; New 2) &quot;Type&quot; defaults to &quot;Quantity&quot;. As soon as I try changing the &quot;Type&quot; to &quot;Price&quot; or &quot;Weight&quot; the page refreshes and goes back to the Hikashop &gt; Products &gt; Limit page list. As a result, I cannot save any Limits unless they are set to Type: Quantity.  Please advise.  Thank you, Dustin")*

Thank you. Can you provide some insight into what value(s) would need to be pulled from the database to display the remaining balance?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NzI0OS1xdWVzdGlvbi1hbmQtZXJyb3Itd2l0aC1saW1pdHM/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14326
-
-

7 years 7 months ago [\#305463](#305463) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Question and error with limits](/forum/27-checkout/897249-question-and-error-with-limits#305463 "-- HikaShop version -- : 4.0.3 -- Joomla version -- : 3.9.4 -- PHP version -- : 7.0.33  I would like to set up a limit for a specific user group to have a spending monthly spending limit for several categories and sub-categories.  Specifically, a $400 monthly limit on all the categories and sub-categories of a vendor (we are using HikaMarket). This would reset to $400 each month.  Few Questions:  1) Can this be done with Limits? 2) Is there a way the user can check how much of their Limit 'balance' they have used / how much is left for the month? 3) Is there a different/better way you would suggest accomplishing this functionality? (we are also using AWOcoupon on this website)  Also, when trying to set up a test Limit in Hikashop, I believe I ran into a bug.  Here are the steps I followed to produce the issue:  1) Hikashop &gt; Products &gt; Limit &gt; New 2) &quot;Type&quot; defaults to &quot;Quantity&quot;. As soon as I try changing the &quot;Type&quot; to &quot;Price&quot; or &quot;Weight&quot; the page refreshes and goes back to the Hikashop &gt; Products &gt; Limit page list. As a result, I cannot save any Limits unless they are set to Type: Quantity.  Please advise.  Thank you, Dustin")*

Hi,

The thing is that the limits are checked dynamically each time you add a product to the cart or load the cart.
So you would have to run a complex MySQL query between the tables hikashop_order, hikashop_order_product, hikashop_product, hikashop_product_category and hikashop_category (or several queries, because one query on 5 tables is quite a beast) in order to pull all the confirmed/shipped orders of all the products of all the categories you want in your limit for the current period and the sum up the price*quantity of each product in the orders and deduct it from the allowance.

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

- **[dustinjc](/forum/user/31466-dustinjc "View dustinjc's Profile")**
- [![dustinjc's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar31466.jpg)](/forum/user/31466-dustinjc "View dustinjc's Profile") Topic Author
- [ Offline](/forum/user/31466-dustinjc)

Less More

- Posts: 176
- Thank you received: 5
-
-

7 years 7 months ago [\#305671](#305671) by [dustinjc](/forum/user/31466-dustinjc "View dustinjc's Profile")  Replied by *[dustinjc](/forum/user/31466-dustinjc "View dustinjc's Profile")* on topic *[Question and error with limits](/forum/27-checkout/897249-question-and-error-with-limits#305671 "-- HikaShop version -- : 4.0.3 -- Joomla version -- : 3.9.4 -- PHP version -- : 7.0.33  I would like to set up a limit for a specific user group to have a spending monthly spending limit for several categories and sub-categories.  Specifically, a $400 monthly limit on all the categories and sub-categories of a vendor (we are using HikaMarket). This would reset to $400 each month.  Few Questions:  1) Can this be done with Limits? 2) Is there a way the user can check how much of their Limit 'balance' they have used / how much is left for the month? 3) Is there a different/better way you would suggest accomplishing this functionality? (we are also using AWOcoupon on this website)  Also, when trying to set up a test Limit in Hikashop, I believe I ran into a bug.  Here are the steps I followed to produce the issue:  1) Hikashop &gt; Products &gt; Limit &gt; New 2) &quot;Type&quot; defaults to &quot;Quantity&quot;. As soon as I try changing the &quot;Type&quot; to &quot;Price&quot; or &quot;Weight&quot; the page refreshes and goes back to the Hikashop &gt; Products &gt; Limit page list. As a result, I cannot save any Limits unless they are set to Type: Quantity.  Please advise.  Thank you, Dustin")*

Would you be able to share the query that is run when the cart is loaded? Perhaps we could duplicate this in a custom dashboard, or have it display in the cart itself during checkout: "Your remaining balance for this month is ... "

Having access to this info is important for our uses. So, any further guidance you can provide would be greatly appreciated.

Thank you,
Dustin

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI3LWNoZWNrb3V0Lzg5NzI0OS1xdWVzdGlvbi1hbmQtZXJyb3Itd2l0aC1saW1pdHM/dG1wbD1tYXJrZG93bg==) 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: 86587
- Thank you received: 14326
-
-

7 years 7 months ago [\#305687](#305687) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Question and error with limits](/forum/27-checkout/897249-question-and-error-with-limits#305687 "-- HikaShop version -- : 4.0.3 -- Joomla version -- : 3.9.4 -- PHP version -- : 7.0.33  I would like to set up a limit for a specific user group to have a spending monthly spending limit for several categories and sub-categories.  Specifically, a $400 monthly limit on all the categories and sub-categories of a vendor (we are using HikaMarket). This would reset to $400 each month.  Few Questions:  1) Can this be done with Limits? 2) Is there a way the user can check how much of their Limit 'balance' they have used / how much is left for the month? 3) Is there a different/better way you would suggest accomplishing this functionality? (we are also using AWOcoupon on this website)  Also, when trying to set up a test Limit in Hikashop, I believe I ran into a bug.  Here are the steps I followed to produce the issue:  1) Hikashop &gt; Products &gt; Limit &gt; New 2) &quot;Type&quot; defaults to &quot;Quantity&quot;. As soon as I try changing the &quot;Type&quot; to &quot;Price&quot; or &quot;Weight&quot; the page refreshes and goes back to the Hikashop &gt; Products &gt; Limit page list. As a result, I cannot save any Limits unless they are set to Type: Quantity.  Please advise.  Thank you, Dustin")*

Hi,

The query is dynamic based on how your limit rules are configured.
You can look at the function getUserOrderProducts in the file administrator/components/com_hikashop/classes/limit.php
That's where the query is constructed to load the products data from the past orders so that you can then sum the prices and quantities already purchased in PHP and then check the limits rules.

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

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