News:

Looking for documentation? Take a look on our wiki

Main Menu

How to modify the in stock info for product

Started by kostianev, October 09, 2017, 16:57:36 PM

Previous topic - Next topic

kostianev

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"

GJC Web Design

<?php
if($this->product->product_in_stock > 0){
echo JTEXT::_('COM_VIRTUEMART_STOCK_AMOUNT');
}
?>
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

kostianev

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?

kostianev

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?

GJC Web Design

always use

if($product->product_in_stock > 0){

in cats views i.e. not $this
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

Studio 42

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 */
}

w360

I know this is a really old post but thanx for the answer here it really made my day a lot easier!
Joomla expert - Virtuemart novice.