VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: restodo on July 31, 2014, 20:04:41 PM

Title: [SOLVED] How to show Products in Stock in Cart ?
Post by: restodo on July 31, 2014, 20:04:41 PM
Hi,

I want to know how to show product_in_stock in cart ?

I know how to show in category ($product->product_in_stock) & product details ($this->product->product_in_stock).


Greets!
Title: Re: How to show Products in Stock in Cart ?
Post by: GJC Web Design on July 31, 2014, 21:45:12 PM
assume would have to get the product model in the template and use one of the functions to return each prodid's parameters

They aren't there as standard - just the cart object

or a query on each prodid to get the stock
Title: Re: How to show Products in Stock in Cart ?
Post by: restodo on July 31, 2014, 22:07:55 PM
Quote from: GJC Web Design on July 31, 2014, 21:45:12 PM
assume would have to get the product model in the template and use one of the functions to return each prodid's parameters

They aren't there as standard - just the cart object

or a query on each prodid to get the stock

Thanks for your answer.

Yes I think you're right because cart object didn't gave me the correct value but I don't know how to get product model.

Title: Re: How to show Products in Stock in Cart ?
Post by: GJC Web Design on July 31, 2014, 22:39:25 PM
something like (haven't tried this)

$productModel = VmModel::getModel('Product');

then in the loop of the default_pricelist.php

$singleproduct = $productModel->getProductSingle ($virtuemart_product_id = $prow->cart_item_id, $front = TRUE, $quantity = 1,$customfields=TRUE,$virtuemart_shoppergroup_ids=0)

stock (maybe ) is   $singleproduct->product_in_stock;
Title: Re: How to show Products in Stock in Cart ?
Post by: restodo on July 31, 2014, 23:57:36 PM
Quote from: GJC Web Design on July 31, 2014, 22:39:25 PM
something like (haven't tried this)

$productModel = VmModel::getModel('Product');

then in the loop of the default_pricelist.php

$singleproduct = $productModel->getProductSingle ($virtuemart_product_id = $prow->cart_item_id, $front = TRUE, $quantity = 1,$customfields=TRUE,$virtuemart_shoppergroup_ids=0)

stock (maybe ) is   $singleproduct->product_in_stock;


Thanks for your help!! it works very good!!

Greets from Argentina.