News:

Support the VirtueMart project and become a member

Main Menu

Stock Level as number

Started by mirovic, April 13, 2012, 16:36:55 PM

Previous topic - Next topic

mirovic

Is it possible to show stock level as number? For example Stock level: 23 .....

agrupe

Hi,

I need that, too. My customers like to know if they can order 100 or 500 pieces. The green box says nothing to this customers.

Is there a plugin which does that?

Thanks

Andreas


agrupe

Thanks for the hint! Works well.

Will this code be overwritten by the next VM update?

Andreas

PRO

Quote from: agrupe on April 22, 2012, 14:10:26 PM
Thanks for the hint! Works well.

Will this code be overwritten by the next VM update?

Andreas


not if you do a template override

http://forum.virtuemart.net/index.php?topic=90935.msg298367#msg298367

mirovic

Of course I tried this before my first post in this forum thread. I need it in category view, so I used code:

<?php echo $product->stock->stock_level ?>

But the result is not number, but text string: normalstock

PRO

Quote from: mirovic on April 22, 2012, 15:27:44 PM
Of course I tried this before my first post in this forum thread. I need it in category view, so I used code:

<?php echo $product->stock->stock_level ?>

But the result is not number, but text string: normalstock

Then maybe you should find the right one

http://forum.virtuemart.net/index.php?topic=92756.0

mirovic

Really don´t know, what I am doing wrong.  :)

Again

when I use this code for category page:
<?php echo $product->stock->stock_level ?>
the result is: normalstock

when I use this code for category page:
<?php echo $this->product->product_in_stock ?>
no result...

when I use this code for category page:
<?php if ($this->product_in_stock <= 10) { ?>
                  <div>ONLY <?php echo $this->product_in_stock ?> In Stock. ORDER BEFORE IT'S TOO LATE</div>
               <?php    }?>

the result is: ONLY In Stock. ORDER BEFORE IT'S TOO LATE

So how use this code for category page to not show text string normalstock, but the number?

PRO


mirovic

 :)

QuoteFor example
On the category page
You call the product name like this
<?php echo $product->product_name ?>

So, I think, on category page I call the product stock level (but number, not text - that´s what I need) like this:
<?php echo $product->stock->stock_level ?>

Isn´t it true?

but the result is text string "normalstock" instead of "12"...

PRO


I thought you wanted how many, and not the level?



<?php echo $product->product_in_stock ?>

mirovic

  ::)

perfect, that works!
many thanks!!!

so, I hadn´t understand, because on here: http://forum.virtuemart.net/index.php?topic=92756.0 (Product Page fields) is written code for product_in_stock in article and not for stock_level and here: http://forum.virtuemart.net/index.php?topic=97744.0 (Catetogory Page fields) is opposite - there is written code for stock_level, but not for product_in_stock.....