Dear, I have custom template and want to integrate the In stock level, but only to show that the product is In stock, I need to hide the quantity.
I use this: <?php echo jtext::_('COM_VIRTUEMART_STOCK_AMOUNT');?>: <?php echo $this->product->product_in_stock; ?>
Now is displaying "In stock: 20" I need only to show the text "In Stock"
<?php
if($this->product->product_in_stock > 0){
echo JTEXT::_('COM_VIRTUEMART_STOCK_AMOUNT');
}
?>
Perfect, this working for me. Can you tell me, if you know - how can I make the code, when the product is not in stock with If / Else function to display other div class with red text Out of stock? Because now I have green div for In Stock level and when is out of stock is displayed in additional without div in red for example?
Can someone tell me how to make this code working in Category View?
<?php
if($this->product->product_in_stock > 0){
echo JTEXT::_('COM_VIRTUEMART_STOCK_AMOUNT');
}
?>
This code is working and show IN STOCK inside the product in the Product Details Page, but not working in Category view page?
I have another code, which is working fine inside the product and in the Category page like this:
<?php if (isset($productItems->productOutOfStock)) : ?>
<?php if (($productItems->productOutOfStock->product_in_stock - $productItems->productOutOfStock->product_ordered) < 1) : ?>
<?php echo JText::_('COM_VIRTUEMART_CART_OUTOFSTOCK'); ?>
<?php endif; ?>
<?php endif; ?>
This code is working, but please can you help me with the IN STOCK code to work in the category page view?
always use
if($product->product_in_stock > 0){
in cats views i.e. not $this
Because Virtuemart have reserved/booked stock, i always use
if($product->product_in_stock > $product->product_ordered) {
/* your code here when you have stock */
}
In product details
if($this->product->product_in_stock > $this->product->product_ordered) {
/* your code here when you have stock */
}
I know this is a really old post but thanx for the answer here it really made my day a lot easier!