VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: stoeny on April 11, 2013, 12:19:48 PM

Title: [ SOLVED ] undefined quantity in field next to [add to Cart] button (VM 2.0.20b)
Post by: stoeny on April 11, 2013, 12:19:48 PM
Hi,

I have a product, with 7 childs. As custom field, I defined a Size with stockable variants.
In my product I configured the 7 sizes to the 7 childs. The parent product has a price, the child products have stock.

Everyting is working fine, except that in the quantity box next to the [add to cart] there is "undefined" in stead off "1".

With a regular product, without custom field and child, it is working fine.

Virtuemart 2.0.20b on Joomla 2.5.9

Pls advice.


Pascal
Title: Re: undefined quantity in field next to [add to Cart] button (VM 2.0.20b)
Post by: stoeny on April 17, 2013, 10:18:11 AM
Nobody?

pls, advice, or I have to start to look to an other solution, i really want to stick to VM.


best regards

Pascal
Title: Re: undefined quantity in field next to [add to Cart] button (VM 2.0.20b)
Post by: jenkinhill on April 17, 2013, 15:25:43 PM
For VM2.0.20b try this:

In plugins/vmcustom/stockable/stockable.php  around line 471 locate:


} else {
var quantity = $(".addtocart-bar .quantity-input").val();
$(".addtocart-bar>span").remove();


replace with:


} else {
var quantity = $.parseJSON(\'' .json_encode((int)$this->product->min_order_level). '\') ;
if (quantity == 0){
quantity = 1;
         }
$(".addtocart-bar>span").remove();
Title: Re: undefined quantity in field next to [add to Cart] button (VM 2.0.20b)
Post by: stoeny on April 18, 2013, 10:17:04 AM
Dear Kelvyn,

Thanks for you're reply.

Unfortunately I can't find this code around line 471, bur online 797 in comment.
Do I have a wrong, older, newer version?


Pascal
Title: Re: undefined quantity in field next to [add to Cart] button (VM 2.0.20b)
Post by: jenkinhill on April 18, 2013, 12:03:52 PM
If you updated from an earlier version maybe you have not also updated with the aio component for 2.0.20b?
Title: Re: undefined quantity in field next to [add to Cart] button (VM 2.0.20b)
Post by: stoeny on April 18, 2013, 13:31:24 PM
Dear Kelvyn,

No upgrade, fresh install.
Can you send me your stockable.php, so i can compare.
you are on 2.0.20b aswell?


Pascal
Title: Re: undefined quantity in field next to [add to Cart] button (VM 2.0.20b)
Post by: jenkinhill on April 18, 2013, 23:44:17 PM
This is from 2.0.20b

[attachment cleanup by admin]
Title: Re: undefined quantity in field next to [add to Cart] button (VM 2.0.20b)
Post by: stoeny on April 19, 2013, 13:50:32 PM
Dear Kelvyn

Problem is solved, thanks four you help.

Actually, the solution that you described on April 17, is the correct one.

Only it was very confusing because :
My stockable.php has between every code line, a blank line, so the line number was not correct.
Off course I searched in the file for the code to be replaced, but there, notepad++ showed me the code in gray (= to comment), so I was confused.


Anyway, thanks for your help!

Pascal