Hi,
Normally, the stock should already automatically display on the frontend.
So it's just a matter of hiding the stock above a certain amount.
On the product details page, it's the view file product / quantity.php (you can find it in the menu Display>Views) which displays the stock with this code:
if(!empty($this->row->product_stock_message))
echo JText::sprintf($this->row->product_stock_message, $stock);
elseif($stock > 0)
echo (($stock == 1 && JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK') ? JText::sprintf('X_ITEM_IN_STOCK', $stock) : JText::sprintf('X_ITEMS_IN_STOCK', $stock));
elseif(!$in_stock)
echo JText::_('NO_STOCK');
So you could adapt the code:
if(!empty($this->row->product_stock_message))
echo JText::sprintf($this->row->product_stock_message, $stock);
elseif($stock > 3)
echo '';
elseif($stock > 0)
echo (($stock == 1 && JText::_('X_ITEM_IN_STOCK') != 'X_ITEM_IN_STOCK') ? JText::sprintf('X_ITEM_IN_STOCK', $stock) : JText::sprintf('X_ITEMS_IN_STOCK', $stock));
elseif(!$in_stock)
echo JText::_('NO_STOCK');
and for the listings, it should be something similar in the file product / add_to_cart_ajax.php