News:

Looking for documentation? Take a look on our wiki

Main Menu

Add to cart does not work

Started by jenkinhill, July 07, 2013, 10:46:42 AM

Previous topic - Next topic

jenkinhill

This is generallly a template problem and mostly a jquery conflict.

You can read in this thread how others found and solved the problem in their specific case

The full thread is at http://forum.virtuemart.net/index.php?topic=95979.0

Summarized:
Quote from: PRO on January 06, 2012, 18:50:17 PM
This is NOT a virtuemart problem 1st of all


There will NOT be a single answer that applies to everyone.
THIS IS A JAVA CONFLICT 99% OF THE TIME
Vmart jquery does NOT conflict with standard joomla mootools.

also, make sure "system cache" plugin is disabled


JQUERY HAS to be loaded for add to cart to work
Virtuemart product scripts have to be loaded.


Templates Have javascript
Modules have Javascript

If a template uses Jquery, let it use jquery, and turn off vmart jquery.
UNLESS the template jquery version is LESS THAN
jQuery JavaScript Library v1.6.1
in that case use vmart jquery and turn of your template jquery.

NOW: If you are using standard joomla template and get the conflict. Are you using modules? Menus? That use javascript?
Disable all modules, and see if the cart works. Then enable them one by one


ALSO; do not edit the add to cart form classes etc. unless you know what you are doing

ALSO Re; css and java script compressors like jch optimize, and all those.
I have not seen a single example of these working with 2.0 yet without messing up cart functions. I have tried on mine, with many configurations etc. Still conflicts with cart functions.

AND see here
http://forum.virtuemart.net/index.php?topic=95879.msg315642#msg315642

Quote from: nflmerch on January 10, 2012, 22:35:35 PM
Quote from: stuclark on January 06, 2012, 18:52:55 PM
Ok, so if this is NOT a VM issue, how come so many people are having issues getting this feature of VM to work???
If it's a JavaScript / template / Joomla / something else issue, then why is it people only get the error with VM? and why is it then SO varied as to whether people are able to fix it???
It's a Javascript conflict, and Java is obviously its own entity, separate from Virtuemart.  You can have ANY shopping cart or website with java, and if you have another java script.... ANY two java scripts might conflict with each other.
And it doesn't have to be a script in the template;  banquettables pointed out that it can also be modules or menus, etc.
Also make sure Product Scripts is on,  under VM admin>Config>Templates>Activate Css Styles & Javascripts

Use a browser with debug function for example Firefox with Firebug. Open your page, while you have the Console open and if there are Javascript errors, you may see them there. More information https://forum.virtuemart.net/index.php?topic=102850.0 and for jQuery JavaScript conflicts and general js debugging see http://forum.virtuemart.net/index.php?topic=119638.0

Check the html code of your page and look (usually only in the header) for lines like

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
<script src="components/com_virtuemart/assets/js/jquery.min.js" type="text/javascript"></script>
<script src="http://yourdomain.com/eu/modules/mod_artnewsticker/js/jquery.js" type="text/javascript"></script>


There MUST be only ONE of this lines. This lines tell your browser to load the jquery framework and it must be loaded only once! So if you see only one line loading the jQuery framework, then everything should work. Btw jquery.min.js is a compressed version of jquery.js ("min" means minified version).

How to disable loading of jQuery by Virtuemart http://dev.virtuemart.net/projects/virtuemart/wiki/General_JS-Problems_with_templates_and_jQuery

This is a general joomla, or better descibed as, a website problem and therefore there are a lot plugins to help with this issue http://extensions.joomla.org/extensions/core-enhancements/performance/jquery-scripts
Not all of them do a good job. They are almost never needed and a pro should always be able to solve the problem by virtuemart/template configuration and similar. But they can be quite handy for an hotfix or beginners.
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