VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: stawebnice on January 28, 2015, 20:58:18 PM

Title: VM2.6.14 - stock info not show when 1 product in stock
Post by: stawebnice on January 28, 2015, 20:58:18 PM
Hi,

please advise. We have a problem with this eshop in VM 2.6.14.
When we have only 1 piece in stock, no availability info is shown on product detail page.
When there are 2 or more pieces in stock, it shows "in stock (skladem)" : http://www.dmack-shop.cz/dmack-dmt-rc-195-50-r15-t5-rally-pneu
and when there is 0, it shows the availability image... http://www.dmack-shop.cz/maxxis-m-6011r-mt90-r16-74h-tl-moto-pneu

is this some by design feature or a bug,or can this be overriden by some settings?

we have these settings in VM:
http://imtp.me/8ybi02lj3.p

temporarily we have solved it by setting the number to 2  and making 1 reserved, but that is no solution for other products whose stock can get to 1 when products are sold...
Title: Re: VM2.6.14 - stock info not show when 1 product in stock
Post by: GJC Web Design on January 28, 2015, 22:55:55 PM
AFAIK stock display is handled by the template

the stocklevel is available in the template as $this->product->product_in_stock

what u do with it is up to the code in the template - e.g. show different images or text etc depending in its value
Title: Re: VM2.6.14 - stock info not show when 1 product in stock
Post by: stawebnice on January 28, 2015, 23:53:02 PM
Thank  you. I have located three files that include the text that you sent me, but  I   am not able to say which is responsible for the strange fact that stock-1 hides the availability...I am attaching them  in the zip. Would you be so kind and take a look at them and advised what should be changed,please?
Title: Re: VM2.6.14 - stock info not show when 1 product in stock
Post by: GJC Web Design on January 29, 2015, 00:07:50 AM
I don't do house calls but as a one off this took 10 seconds to find

        <?php
if ($this->product->product_in_stock < 1) {
echo  "Dostupnost: Na dotaz";
} else {
if ($this->product->product_in_stock > 1) {
echo  "Dostupnost: Skladem";
}
} ?>

so less than 1 ->

then more than 1->

and when it is 1 ?????????????????????????????????

hmmmmm -- who's responsible for this code?
Title: Re: VM2.6.14 - stock info not show when 1 product in stock
Post by: stawebnice on January 29, 2015, 00:16:52 AM
a desperate friend of mine, who created the shop had other people fix things for him and now he asked me to clean the mess. Thank you! I owe you!