Author Topic: Stocklevel on product detail page  (Read 5080 times)

groentjie

  • Jr. Member
  • **
  • Posts: 87
Stocklevel on product detail page
« on: January 03, 2012, 15:19:09 pm »
How can I show the stocklevel graphic on the productdetail page?

flaterik

  • Jr. Member
  • **
  • Posts: 100
Re: Stocklevel on product detail page
« Reply #1 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

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stocklevel on product detail page
« Reply #2 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

supermac

  • Jr. Member
  • **
  • Posts: 68
Re: Stocklevel on product detail page
« Reply #3 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)

Code: [Select]
<?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  :-[

huegel-huepfer

  • Beginner
  • *
  • Posts: 7
Re: Stocklevel on product detail page
« Reply #4 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?
Joomla 2.5.6

VM 2.0.8e

maxi1973

  • Jr. Member
  • **
  • Posts: 68
Re: Stocklevel on product detail page
« Reply #5 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.


Code: [Select]
<?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 }?>

Maxim Pishnyak

  • Global Moderator
  • Sr. Member
  • *
  • Posts: 2656
Re: Stocklevel on product detail page
« Reply #6 on: September 30, 2013, 06:40:17 am »
Thank you for sharing!
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart

lostmail

  • Jr. Member
  • **
  • Posts: 317
Stocklevel different in category view and product detail view
« Reply #7 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]
Joomla 3.x + VirtueMart 4.0.2 10661 HORME3 PRO 1.9.6

lostmail

  • Jr. Member
  • **
  • Posts: 317
Re: Stocklevel on product detail page
« Reply #8 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"
Joomla 3.x + VirtueMart 4.0.2 10661 HORME3 PRO 1.9.6

lanthan

  • Jr. Member
  • **
  • Posts: 99
  • VM 2.6.10, J2.5.27, PHP5.5
Re: Stocklevel on product detail page
« Reply #9 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