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

#   Badges based on stock range

##

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

Less More

- Posts: 282
- Thank you received: 42
-
-

1 year 8 months ago [\#365760](#365760) by [oxido](/forum/user/29793-oxido "View oxido's Profile")  *[Badges based on stock range](/forum/50-feature-request/909165-badges-based-on-stock-range#365760 "-- HikaShop version -- : 5.1.3 -- Joomla version -- : 5.2.3 -- PHP version -- : 8.1  Hi I was looking for a way to dispaly 3 badges based on stock &quot;enough quantity&quot; when the stock is over lets say 20 - and more &quot;limited quantity&quot; when the stock is 1-19 &quot;no stock&quot; when the stock is 0. limited quantity I see that when I create a badge, there is an option for quantity, but the badge it is displayed only when that quantity is identical with that value. Now, while I was writing this, I was thinking to use mass actions + cron job and to create 2 categories for the &quot;enough quantity&quot; and &quot;limited quantity&quot; and with the mass action and cron job to add any of the category to the products. Doing that, I can link the badge to the category. But for that I would have to run a cron job quite often for all products, it seems a bit overkill to me. That's why I think using a range would be more useful.  And I would also have a suggestion for badges, maybe custom fields can be brought into the discussion here as a future feature :whistle: Thank you, and have a nice day!")* was created by *[oxido](/forum/user/29793-oxido "View oxido's Profile")*

-- HikaShop version -- : 5.1.3
-- Joomla version -- : 5.2.3
-- PHP version -- : 8.1

Hi
I was looking for a way to dispaly 3 badges based on stock
"enough quantity" when the stock is over lets say 20 - and more
"limited quantity" when the stock is 1-19
"no stock" when the stock is 0.
limited quantity I see that when I create a badge, there is an option for quantity, but the badge it is displayed only when that quantity is identical with that value.
Now, while I was writing this, I was thinking to use mass actions + cron job and to create 2 categories for the "enough quantity" and "limited quantity" and with the mass action and cron job to add any of the category to the products.
Doing that, I can link the badge to the category.
But for that I would have to run a cron job quite often for all products, it seems a bit overkill to me.
That's why I think using a range would be more useful.

And I would also have a suggestion for badges, maybe custom fields can be brought into the discussion here as a future feature :whistle:
Thank you, and have a nice day!

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

Less More

- Posts: 86289
- Thank you received: 14265
-
-

1 year 8 months ago [\#365764](#365764) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Badges based on stock range](/forum/50-feature-request/909165-badges-based-on-stock-range#365764 "-- HikaShop version -- : 5.1.3 -- Joomla version -- : 5.2.3 -- PHP version -- : 8.1  Hi I was looking for a way to dispaly 3 badges based on stock &quot;enough quantity&quot; when the stock is over lets say 20 - and more &quot;limited quantity&quot; when the stock is 1-19 &quot;no stock&quot; when the stock is 0. limited quantity I see that when I create a badge, there is an option for quantity, but the badge it is displayed only when that quantity is identical with that value. Now, while I was writing this, I was thinking to use mass actions + cron job and to create 2 categories for the &quot;enough quantity&quot; and &quot;limited quantity&quot; and with the mass action and cron job to add any of the category to the products. Doing that, I can link the badge to the category. But for that I would have to run a cron job quite often for all products, it seems a bit overkill to me. That's why I think using a range would be more useful.  And I would also have a suggestion for badges, maybe custom fields can be brought into the discussion here as a future feature :whistle: Thank you, and have a nice day!")*

Hi,

If your mass actions are properly configured I don't see a problem with that.
For example, you can have a mass action with :
- a trigger "every minute" (it will actually run each time the cron task is triggered)
- a filter on product_quantity &gt; 0
- a filter on product_quantity &lt; 20
- a filter on category_id != XX (where XX is the id of the category for products with stock between 1 and 20 )
- an action "update the categories" "add" category with the id XX
- an action "update the categories" "remove" category with the id YY (where YY is the id of the category for products with stock above 20 )
This way, the mass action will filter out the products to process only the products for which the category is missing and it should be there.

Regarding the reason why it's not a range:
That's because we thought that badges were used mainly to promote products or easily see that products are one of stock.
So we tought that having only a matching value would be enough. But thanks for your feedback. We'll take it into account for future improvements.

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

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

[](#top)
