2 hours ago, rb10 said:thanks for reply, but download not works
here is a general approach, you will need to customize to meet your needs
Step 1: Edit your product template
Go to your theme’s template file:
For product pages:
/themes/your-theme/templates/catalog/product.tpl
For category/listing pages:
/themes/your-theme/templates/catalog/_partials/miniatures/product.tpl
Insert this code where you want the quantity message to appear:
{* PrestaHeroes Stock Status Message *}
{if $product.quantity == 0}
<div class="stock-status out-of-stock">Not Available</div>
{elseif $product.quantity == 1}
<div class="stock-status low-stock">Last piece!</div>
{elseif $product.quantity <= 10}
<div class="stock-status medium-stock">Medium availability</div>
{elseif $product.quantity <= 20}
<div class="stock-status good-stock">Good availability</div>
{else}
<div class="stock-status in-stock">Excellent availability</div>
{/if}
Step 2: Add your CSS
Add the following to your theme’s CSS file:
.stock-status { font-weight: bold; margin: 10px 0; }
.out-of-stock { color: #d32f2f; }
.low-stock { color: #fbc02d; }
.medium-stock { color: #388e3c; }
.good-stock { color: #1976d2; }
.in-stock { color: #388e3c; }
Step 3: Make sure $product.quantity is available
On the product page, this variable is usually already available.
On category/listing pages, make sure your controller passes the quantity to the template.