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

#   Discount Qty

##

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

Less More

- Posts: 240
- Thank you received: 13
-
-

9 months 2 weeks ago [\#370150](#370150) by [khashiz](/forum/user/61259-khashiz "View khashiz's Profile")  *[Discount Qty](/forum/26-product-category-display/910062-discount-qty#370150 "-- HikaShop version -- : 6.2.0 -- Joomla version -- : 6.0.2 -- PHP version -- : 8.3  hi how can i create something like attached image in hikashop ? the quantity of products in my site is unlimited, but i want sell only 20 of each with discount  i know there is an option in create discounts to limi the number of pacheses, however i want to show how much of that product has been sold with discouns  something like attached image")* was created by *[khashiz](/forum/user/61259-khashiz "View khashiz's Profile")*

-- HikaShop version -- : 6.2.0
-- Joomla version -- : 6.0.2
-- PHP version -- : 8.3

hi
how can i create something like attached image in hikashop ?
the quantity of products in my site is unlimited, but i want sell only 20 of each with discount

i know there is an option in create discounts to limi the number of pacheses, however i want to show how much of that product has been sold with discouns

something like attached image  [ ![2026-01-27&#95;01-47-25.png](/forum/attachment/61170) ](/forum/attachment/61170 "...7&#95;01-47-25.png")

[ ![2026-01-27&#95;01-47-25.png](/forum/attachment/61170) ](/forum/attachment/61170 "...7&#95;01-47-25.png")

- [ ![2026-01-27&#95;01-47-25.png](/forum/attachment/61170) ](/forum/attachment/61170 "...7&#95;01-47-25.png") [ ](/forum/attachment/61170?download=1 "...7&#95;01-47-25.png")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS85MTAwNjItZGlzY291bnQtcXR5P3RtcGw9bWFya2Rvd24=) 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: 86541
- Thank you received: 14304
-
-

9 months 2 weeks ago [\#370152](#370152) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount Qty](/forum/26-product-category-display/910062-discount-qty#370152 "-- HikaShop version -- : 6.2.0 -- Joomla version -- : 6.0.2 -- PHP version -- : 8.3  hi how can i create something like attached image in hikashop ? the quantity of products in my site is unlimited, but i want sell only 20 of each with discount  i know there is an option in create discounts to limi the number of pacheses, however i want to show how much of that product has been sold with discouns  something like attached image")*

Hi,

You can achieve this by adding a small code snippet to your view override of product / listing_img_title.php via the menu Display&gt;Views and a custom product field where you can provide the initial stock of the product.
Assuming your custom field calls its column initial_stock, you can insert the following code where you want the bar to appear (for example, just after the product image div/span): Code:

&lt;?php // CUSTOM PROGRESS BAR if(!empty($this-&gt;row-&gt;initial_stock) &amp;&amp; (int)$this-&gt;row-&gt;initial_stock &gt; 0) { $initial = (int)$this-&gt;row-&gt;initial_stock; $current = (int)$this-&gt;row-&gt;product_quantity; // Calculate percentage remaining. // To show "percentage sold" instead, use: $percent = 100 - (($current / $initial) * 100); $percent = ($current / $initial) * 100; $percent = max(0, min(100, $percent)); // Keep between 0-100 ?&gt; &lt;div class="hikashop_stock_progress" style="margin: 5px 0;"&gt; &lt;!-- The Bar Container --&gt; &lt;div style="background-color: #f3f3f3; height: 10px; border-radius: 5px; overflow: hidden; border: 1px solid #ddd;"&gt; &lt;div style="background-color: #28a745; height: 100%; width: &lt;?php echo $percent; ?&gt;%;"&gt;&lt;/div&gt; &lt;/div&gt; &lt;!-- The Text Info --&gt; &lt;div style="text-align: center; font-size: 11px; margin-top: 2px; color: #555;"&gt; &lt;?php echo $current; ?&gt; / &lt;?php echo $initial; ?&gt; items left &lt;/div&gt; &lt;/div&gt; &lt;?php } ?&gt;

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

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

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

Less More

- Posts: 240
- Thank you received: 13
-
-

9 months 2 weeks ago [\#370164](#370164) by [khashiz](/forum/user/61259-khashiz "View khashiz's Profile")  Replied by *[khashiz](/forum/user/61259-khashiz "View khashiz's Profile")* on topic *[Discount Qty](/forum/26-product-category-display/910062-discount-qty#370164 "-- HikaShop version -- : 6.2.0 -- Joomla version -- : 6.0.2 -- PHP version -- : 8.3  hi how can i create something like attached image in hikashop ? the quantity of products in my site is unlimited, but i want sell only 20 of each with discount  i know there is an option in create discounts to limi the number of pacheses, however i want to show how much of that product has been sold with discouns  something like attached image")*

so i have to create a custom field ?

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzI2LXByb2R1Y3QtY2F0ZWdvcnktZGlzcGxheS85MTAwNjItZGlzY291bnQtcXR5P3RtcGw9bWFya2Rvd24=) 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: 86541
- Thank you received: 14304
-
-

9 months 2 weeks ago [\#370165](#370165) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[Discount Qty](/forum/26-product-category-display/910062-discount-qty#370165 "-- HikaShop version -- : 6.2.0 -- Joomla version -- : 6.0.2 -- PHP version -- : 8.3  hi how can i create something like attached image in hikashop ? the quantity of products in my site is unlimited, but i want sell only 20 of each with discount  i know there is an option in create discounts to limi the number of pacheses, however i want to show how much of that product has been sold with discouns  something like attached image")*

Hi,

Yes, of the table "product", with the column name "initial_stock" so that you can provide the initial stock amount before purchases are made. The normal stock will decrement upon purchase, while this initial stock value will stay the same so that the progress bar can be calculated against it.

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

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

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