News:

Looking for documentation? Take a look on our wiki

Main Menu

stock level in product details

Started by guardiano78, June 13, 2015, 15:52:06 PM

Previous topic - Next topic

guardiano78

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

guardiano78

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.

mhuebler

push !

why '$this->product->stock->stock_level' not work ?

Spiros Petrakis

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 ?>
VirtueMart 4 templates for Joomla! 5
https://www.templatewarrior.com