That didn't the trick. The problem is when the stock quantity is negative, it thinks it is low stock. Of course it should think it is 'out of stock'. Strangly, on the product category page the stock level is correct...
For now, because I don't use 'low stock' in the backed, I just changed the translation of "COM_VIRTUEMART_SEARCH_ORDER_LOW_STOCK_NOTIFICATION". The translation is now the same as 'Out of stock', so there is no difference.
I removed the stock level image, so there is only text, saying the item is on stock or isn't on stock. I used this code:
- Code: Select all
<?php
$ProductModel= VmModel::getModel('product');
$product = $ProductModel->getProduct($item->virtuemart_product_id);
$stock = $product->product_in_stock;
$lowstock = $product->low_stock_notification;
$stocklevel= "normalstock";
$stocktip = JText::_ ('COM_VIRTUEMART_PRODUCT_IN_STOCK');
if ($stock <= $lowstock) {
$stocklevel = "lowstock";
$stocktip = JText::_ ('COM_VIRTUEMART_SEARCH_ORDER_LOW_STOCK_NOTIFICATION');}
if (empty($stock)) {
$stocklevel = "nostock";
$stocktip = JText::_ ('COM_VIRTUEMART_CART_PRODUCT_OUT_OF_STOCK');}
?>
<span class="stock-level">