VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: alexzien on September 23, 2015, 10:12:31 AM

Title: Add to cart and quantity buttons doesn't work?
Post by: alexzien on September 23, 2015, 10:12:31 AM
On the product details page "Add to cart" directly sends you to the shopping cart page without adding the product in the cart. The modal popup windows don't open at all. I also can't change the quantity with the + and - buttons. Look at this page: http://goo.gl/kLZ8bw.

All this works though on the first page of Virtuemart, here: http://goo.gl/TmqiX0.

I have looked if I got multiple jQuery scripts loaded, but can't figure out if I have it or not. I have tried plugins such as jqueryeasy and JB Library, but it still doesn't work.
I have also searched the forum and found similar problems and tried pretty much all solutions I have found. Nothing works for me.

Any other suggestion?

VM 3.0.9
J 3.2.7 (I can't upgrade since PHP version on server is too low).
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: jenkinhill on September 23, 2015, 10:51:30 AM
JavaScript error:  TypeError: jQuery(...).chosen is not a function

Maybe because you are loading an old version of jQuery.  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js" type="text/javascript"></script>

Currently VirtueMart  uses jQuery v1.11.3

By old version of PHP do you mean before PHP 5.3.10?  I'm not sure if current VM works properly on older PHP versions.
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: alexzien on September 25, 2015, 15:21:07 PM
Thank you for your answer.

I have now changed to later version of jQuery, but the issue still remain. It's really weird that the popup works in "Latest products" in Virtuemart but not in the product details.
The server use PHP 5.3.3 and can't be changed unfortunately.

Edit: I have made a migration now and have the latest version of Joomla and a later version of PHP on another server with the same website. But the issue is still there.
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: jimleeder123 on September 25, 2015, 15:23:45 PM
We recently updated our server to the latest PHP level. Good thing is you can set it to use a certain PHP level on specific domains (if you use Plesk like us) so it won't bugger up other websites.
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: GJC Web Design on September 26, 2015, 13:49:39 PM
Your Jquery is still too old and your still not loading chosen.js

TypeError: jQuery(...).chosen is not a function

plenty of posts on here about using jqueryeasy to fix this
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: alexzien on September 29, 2015, 08:06:00 AM
Quote from: GJC Web Design on September 26, 2015, 13:49:39 PM
Your Jquery is still too old and your still not loading chosen.js

TypeError: jQuery(...).chosen is not a function

plenty of posts on here about using jqueryeasy to fix this
I have installed Jqueryeasy but that plugin crashes the other "Add to cart" buttons aswell. Now no one of the "Add to cart" works. I have the plugin activated and use jQuery 1.11 in it. I have also tried all of the settings for it, without solving the problem.
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: GJC Web Design on September 29, 2015, 10:34:10 AM
Now your not loading any jquery at all!!!!!!!

dozens of js errors in the console

read the docs on how to set up jqueryeasy and use the console to check for errors
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: alexzien on September 29, 2015, 11:14:59 AM
Quote from: GJC Web Design on September 29, 2015, 10:34:10 AM
Now your not loading any jquery at all!!!!!!!

dozens of js errors in the console

read the docs on how to set up jqueryeasy and use the console to check for errors
Sorry, I'm not that good at jQuery and such.

I have fixed the loading of jQuery now but it still doesn't work.
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: GJC Web Design on September 29, 2015, 11:38:34 AM
which takes you straight back to

TypeError: jQuery(...).chosen is not a function
   
});

you are still not loading chosen.js - google on here.. this has been mentioned a lot
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: alexzien on September 29, 2015, 11:53:53 AM
I have now added the url to chosen.js in the field "Add script" in Jqueryeasy plugin.

When I look in the console now it says:

Uncaught TypeError: jQuery(...).live is not a function
(anonymous function)   @   allt-i-ett-detail:466
m.Callbacks.j   @   jquery.js:3148
m.Callbacks.k.fireWith   @   jquery.js:3260
m.extend.ready   @   jquery.js:3472
J   @   jquery.js:3503

Thank you for helping me btw, it's very much appreciated.
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: GJC Web Design on September 30, 2015, 11:37:30 AM
is your AIO up to date  update both to 3.0.10

that script
<script type="text/javascript" id="vm.CartModule.UpdateModule_js">//<![CDATA[
jQuery(document).ready(function(){
    jQuery("body").live("updateVirtueMartCartModule", function(e) {
        jQuery("#vmCartModule").updateVirtueMartCartModule();
    });
}); //]]>
</script>

doesn't exist in VM3.0.10
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: alexzien on September 30, 2015, 11:48:42 AM
I have updated to version 3.0.10 for both AIO and VM now, but still same error.
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: GJC Web Design on September 30, 2015, 12:10:48 PM
well .. that inline script is not on a fresh VM install - remove any vm cart over rides
Title: Re: Add to cart and quantity buttons doesn't work?
Post by: alexzien on October 07, 2015, 11:11:00 AM
FINALLY. I found what caused it. When I selected to show prices again in Configuration -> Pricing it started to work! It wasn't a JS problem at all...

So, now my question is why this happen when you don't want to show prices? I don't want customers to be able to see the price, but still order the products.