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

#   Notification if someone change quantity

##

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

Less More

- Posts: 1195
- Thank you received: 13
-
-

3 years 7 months ago [\#350213](#350213) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  *[Notification if someone change quantity](/forum/4-how-to/906099-notification-if-someone-change-quantity#350213 "Hello! Is there a way to restrict the quantity edit on certain usergroups? Or notify via email the admin if somenone saves a product with changed number in the field quantity?")* was created by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")*

Hello!
Is there a way to restrict the quantity edit on certain usergroups?
Or notify via email the admin if somenone saves a product with changed number in the field quantity?

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

3 years 7 months ago [\#350217](#350217) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Notification if someone change quantity](/forum/4-how-to/906099-notification-if-someone-change-quantity#350217 "Hello! Is there a way to restrict the quantity edit on certain usergroups? Or notify via email the admin if somenone saves a product with changed number in the field quantity?")*

Hi,

While there is no ready-made solution, there are two things I can propose:
- This plugin integrates with Joomla's logging system:
[ www.hikashop.com/marketplace/product/161-action-log.html](https://www.hikashop.com/marketplace/product/161-action-log.html)
With it, you can log who modified the products when.
- You could create a mass action with a trigger "before a product is updated" and an action "run PHP code".
In the action, you can write a bit of PHP to:
1. check if the quantity is being changed
2. check the user group of the current user
3. stop the process with an error message
For example, something like that (not tested): Code:

$new_qty = (int)'{product_quantity}'; $db = JFactory::getDBO(); $db-&gt;setQuery('SELECT product_quantity FROM #__hikashop_product WHERE product_id = {product_id}'); $old_qty = $db-&gt;loadResult(); if($new_qty != $old_qty) { if(!hikashop_isAllowed('XXX,YYY')) { die('you are not allowed to change the quantity'); } }

where XXX and YYY are the user groups allowed to change the quantity. You might also want to add a check on whether you're on the backend or not, as some processes on the frontend might change the quantity while you might not want to trigger your mass action at that time.

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

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

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

Less More

- Posts: 1195
- Thank you received: 13
-
-

3 years 7 months ago [\#350408](#350408) by [verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")  Replied by *[verzevoul](/forum/user/8351-verzevoul "View verzevoul's Profile")* on topic *[Notification if someone change quantity](/forum/4-how-to/906099-notification-if-someone-change-quantity#350408 "Hello! Is there a way to restrict the quantity edit on certain usergroups? Or notify via email the admin if somenone saves a product with changed number in the field quantity?")*

Hello!
Can we add on the script you send me 2 more checks?
Prevent unpublish of products and delete?

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

3 years 7 months ago [\#350414](#350414) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Notification if someone change quantity](/forum/4-how-to/906099-notification-if-someone-change-quantity#350414 "Hello! Is there a way to restrict the quantity edit on certain usergroups? Or notify via email the admin if somenone saves a product with changed number in the field quantity?")*

Hi,

This would require new mass actions to be created with different code.
For the unpublish, it's quite easy. You would basically just change "product_quantity" to "product_published" in the code.

For the delete, you would just have the "before a product is deleted" trigger, and the code would simplify to just: Code:

if(!hikashop_isAllowed('XXX,YYY')) { die('you are not allowed to change the quantity'); }

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

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