How can I show the stocklevel graphic on the productdetail page?
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
did you solved?
I got the same need
http://forum.virtuemart.net/index.php?topic=96231.0
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 :-[
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?
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', 1 )) ){?>
<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 }?>
Thank you for sharing!
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]
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"
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