[ SOLVED ] undefined quantity in field next to [add to Cart] button (VM 2.0.20b)

Started by stoeny, April 11, 2013, 12:19:48 PM

Previous topic - Next topic

stoeny

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

stoeny

Nobody?

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


best regards

Pascal

jenkinhill

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();
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

stoeny

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

jenkinhill

If you updated from an earlier version maybe you have not also updated with the aio component for 2.0.20b?
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

stoeny

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

jenkinhill

Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

stoeny

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