VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: guardiano78 on June 13, 2015, 15:52:06 PM

Title: stock level in product details
Post by: guardiano78 on June 13, 2015, 15:52:06 PM
Hello,
i need to display stock level also in product details.
i found in page template this code:

echo shopFunctionsF::renderVmSubLayout('stockhandle',array('product'=>$this->product));

but it doesn't work.

How can i do?

Thanks.


joomla 3.4.1 - virtuemart 3.0.9
Title: Re: stock level in product details
Post by: guardiano78 on June 13, 2015, 16:33:04 PM
i'm trying to put in this:

<span class="vmicon vm2-<?php echo $this->product->stock->stock_level ?>" title="<?php echo $this->product->stock->stock_tip ?>"></span>

but nothing appears.
Title: Re: stock level in product details
Post by: mhuebler on August 23, 2016, 16:40:06 PM
push !

why '$this->product->stock->stock_level' not work ?
Title: Re: stock level in product details
Post by: Spiros Petrakis on August 24, 2016, 14:58:50 PM
Try the following in productdetails.php view:

1) Add this code near the top of the file

// Get stock indicators
$productmodel = VmModel::getModel('product');
$stockinfo = $productmodel->getStockIndicator($this->product);


2) Then add the following code in the file at the place you like to display the stock level

<?php if ( VmConfig::get ('display_stock'1)) { ?>
<span class="vmicon vm2-<?php echo $stockinfo->stock_level ?>" title="<?php echo $stockinfo->stock_tip ?>"></span>
<?php ?>