So I am trying to get the available inventory to show in the product info on the product list. So like it would have the price then Available inventory right below it. I was looking for solutions online but not of them seemed to work (whenever i tried an example it wouldn't show and product or would just show an error message).
I noticed that people were saying if you set 'Display products availability in stock in the frontend' in system->configuration->inventory to YES then it would displays an availability message indicating the product stock status. I have it set to yes, however it does not say if it is ever in stock, only if it is out of stock.
People were also saying that this was all programmed in /app/design/frontend/XXX/YYY/template/catalog/product/list.html. I looked in there and none of the code looks like it would do this. So if anyone has a way to display the Available Inventory it would be much appreciated.
Update: I found a code that used getQty() but it did not work (it printed 0 for every product).
Update: The answer below works but has decimal places. To remove those decimals I used round(). So the final code I used was:
$num= Mage::getModel('cataloginventory/stock_item')->loadByProduct($_product)->getQty(); $num = round($num); echo "Remaining products: ".$num;