VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: groentjie on January 03, 2012, 15:19:09 PM

Title: Stocklevel on product detail page
Post by: groentjie on January 03, 2012, 15:19:09 PM
How can I show the stocklevel graphic on the productdetail page?
Title: Re: Stocklevel on product detail page
Post by: flaterik on January 04, 2012, 12:24:01 PM
Same problem.
I try to use the function for the category view but doesn't work

The field that doesn't work is
<span title="" class="vmicon vm2-"></span>

The variable <?php echo $product->stock->stock_level ?> is empty. That we need is how to use this var on productdetails . On category work correctly, so i think that could be use on productdetails but the field isn't the same or is necessary to load another part of code
Title: Re: Stocklevel on product detail page
Post by: supermac on January 17, 2012, 12:11:04 PM
did you solved?
I got the same need
http://forum.virtuemart.net/index.php?topic=96231.0
Title: Re: Stocklevel on product detail page
Post by: supermac on January 17, 2012, 13:25:04 PM
I found this solution, even if I don't like to modify php pages....
Place this piece of code where you like to show the product's stock in productdetail page
( \components\com_virtuemart\views\productdetails\tmpl\default.php)


<?php 
$stato "";
$statotip "";
if ($this->product->product_in_stock 10) {
$stato "nostock";
$statotip "Hurry! Very low items stock!";
} else {
if ($this->product->product_in_stock 40) {
$stato "lowstock";
$statotip "Low items in stock!";
} else {
$stato "normalstock";
$statotip "Items in stock available!";
}
?>

<span class="vmicon vm2-<?php echo $stato ?>" title="<?php echo $statotip ?>"></span>



:-[ sorry for my poor english  :-[
Title: Re: Stocklevel on product detail page
Post by: huegel-huepfer on July 18, 2012, 15:31:02 PM
That helped me a lot, thanks!

At the moment I try to display current stock of an child product in parent product page.


I placed the stock variants plugin in my parent product. There you can choose between different parameters.
The regular "Availability Image" does show the current stock of the chosen child, but the "vmicon" does still show parents availability...


Are there any suggestions how to realize what I want?
Title: Re: Stocklevel on product detail page
Post by: maxi1973 on September 29, 2013, 12:13:42 PM
For anyone have a multilanguage website, i've adopted this modification to SUPERMAC (thank you ;)) to have availability in multilanguage.
i've done a little modification to have NO availability for <1 product; low availability for <4 products otherwise large availability.


<?php 
$stato "";
$statotip "";
if ($this->product->product_in_stock 1) { ?>

<?php $stato = "nostock"; ?>
<?php $statotip =  JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_OUT_TIP'); ?>
<?php } else {
if ($this->product->product_in_stock 4) {?>

<?php $stato = "lowstock"; ?>
<?php $statotip = JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_LOW_TIP'); ?>;
<?php } else { ?>
<?php $stato = "normalstock"; ?>
<?php $statotip = JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_NORMAL_TIP'); ?>;
<?php }
?>


<?php if (!VmConfig::get('use_as_catalog') and !(VmConfig::get('stockhandle','none')=='none') && (VmConfig::get 'display_stock')) ){?>
<div class="padding-stock">
<span class="stock-level"><?php echo JText::_('COM_VIRTUEMART_STOCK_LEVEL_DISPLAY_TITLE_TIP'?></span>
<span class="vmicon vm2-<?php echo $stato ?>"  title="<?php echo $statotip ?>"></span>

</div>
<?php }?>
Title: Re: Stocklevel on product detail page
Post by: Maxim Pishnyak on September 30, 2013, 06:40:17 AM
Thank you for sharing!
Title: Stocklevel different in category view and product detail view
Post by: lostmail on October 21, 2013, 12:14:39 PM
I have currently a mysterious thing between category fiew and product details view:

In Category view 2 products are yellow and green status but both products have the same stock amount 1 pcs.

So the green bar from product 1 is wrong - it should even be yellow in category view.

wheni click in produt detail - both products are yellow - what is correct.





[attachment cleanup by admin]
Title: Re: Stocklevel on product detail page
Post by: lostmail on October 21, 2013, 12:54:17 PM
It seems to be the field "Message for low stock level" - i have one product set to "0" and the other "5".
So in category view the first product has not a "low stock level"....

How can I set a hard coded low stock level (default for all products) for category view ?

In product details i have a hard coded low stock level of "5"
Title: Re: Stocklevel on product detail page
Post by: lanthan on February 26, 2014, 16:21:43 PM
Hi lostmail,
donĀ“t know if you still need this. If you use my solution (see link), you can edit the "low stock level" on the productstatus page of your product.

http://forum.virtuemart.net/index.php?topic=122391.msg417891#msg417891

Best regards