VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: dhatzi on June 05, 2020, 16:39:41 PM

Title: Display remain quantity of the product and not all the quantity
Post by: dhatzi on June 05, 2020, 16:39:41 PM
Hello guys,

is ti possible to display the remaining quantity of the products (quantity - sold) in product view and not the quantity of the products defined in the begginning?

Thank you in advance
Title: Re: Display remain quantity of the product and not all the quantity
Post by: GJC Web Design on June 05, 2020, 23:32:30 PM
VM already does this as standard... 
Title: Re: Display remain quantity of the product and not all the quantity
Post by: dhatzi on June 09, 2020, 11:41:12 AM
Hello,

how this can be done?
Title: Re: Display remain quantity of the product and not all the quantity
Post by: dhatzi on June 10, 2020, 11:08:37 AM
I am asking that because in my shop if I set ie 100 pcs for an item and I do some purchases stock values remain the same 100
Title: Re: Display remain quantity of the product and not all the quantity
Post by: dhatzi on June 10, 2020, 11:18:28 AM
I have sell 20 pcs from an item and I had from the beginning 100 pcs set. It still displays Quantity In Stock 100 and not 80

Title: Re: Display remain quantity of the product and not all the quantity
Post by: Jörgen on June 10, 2020, 11:22:48 AM
Update, new install ?

VM version ?

Joomla version ?

PHP version ?

Custom Template ?

What stock values ? In front end or back end ?

If You look in back end, what does In stock say and what does booked say ?

Do you set status to shipped or eq when You ship items ?
Does this status move booked to In stock ?

Without that stock will never be decreased.

Jörgen @ Kreativ Fotografi
Title: Re: Display remain quantity of the product and not all the quantity
Post by: Jörgen on June 10, 2020, 11:26:05 AM
Your template shows "In stock" this will be in stock as long as You do not ship the items. Available items is the difference between instock and booked. This is what Your template should show instead of just instock.

Jörgen
Title: Re: Display remain quantity of the product and not all the quantity
Post by: GJC Web Design on June 10, 2020, 14:27:08 PM
if u want stock - booked then change the call in the template 

$product->product_in_stock - $product->product_ordered
Title: Re: Display remain quantity of the product and not all the quantity
Post by: pinochico on June 10, 2020, 17:10:23 PM
QuoteI have sell 20 pcs from an item and I had from the beginning 100 pcs set. It still displays Quantity In Stock 100 and not 80

Template problem and custom developping.

On override for product templatein your template:

templates/your_template/html/com_virtuemart/productdetails/default.php

find info about stock and change to:


<?php 
$stock 
$this->product->product_in_stock $this->product->product_ordered;
echo 
$stock;
?>



If you use on categoriy view then

$this->product

change to

$product
Title: Re: Display remain quantity of the product and not all the quantity
Post by: dhatzi on June 23, 2020, 12:50:03 PM
Thank you guys. I appreciate your help