News:

Support the VirtueMart project and become a member

Main Menu

Add to cart issues - what's the actual solution?

Started by stuclark, January 06, 2012, 18:30:11 PM

Previous topic - Next topic

stuclark

EXPLANATION IN POST 2   BANQUETTABLES.PRO


There's lots of posts on these forums about issues getting products to add to the cart properly in VM2. I've been suffering from this issue myself and haven't been able to find a full fix; so I thought it might be helpful to try to link all the discussions together so everyone can try to understand what does and doesn't work.

In my case, I'm using the JS_Elated template, which does indeed load jquery within the template. The solution I have so far (which works *most of the time* with Firefox and Chrome, but NOT in IE) was to delete the jquery line from the main JS_Elated template file so it's only loaded when Virtuemart wants it. I then turned ON all the json options in Virtuemart configuration, as turning off ANY of them caused add to cart to break completely.

However, as I've just said, this has NOT fixed the problem in IE for me so is only a partial fix.

Other threads discussing the same issue are:
http://forum.virtuemart.net/index.php?topic=95765.0
http://forum.virtuemart.net/index.php?topic=95977.0
http://forum.virtuemart.net/index.php?topic=95879.0
http://forum.virtuemart.net/index.php?topic=92815.0
http://forum.virtuemart.net/index.php?topic=95699.0
http://forum.virtuemart.net/index.php?topic=95394.0
http://forum.virtuemart.net/index.php?topic=92421.0

...and others I'm sure.

Please add useful tips on what you may have done to fix these issues in this thread. (admins, can this be a sticky so *everyone* can find it?)

PRO

#1
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

stuclark

#2
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???

And how do we find out what version of jQuery might be in use by a particular template / module?

stuclark


PRO


Cleanshooter

#5
Quote from: stuclark on January 06, 2012, 18:52:55 PM
And how do we find out what version of jQuery might be in use by a particular template / module?

If a module/template/component is using jQuery it should tell you which version in the Javascript Library ( /js directory for most). 

For example if you open component/com_virtuemart/assets/js/jquery.js you will see right at the top it uses version 1.4.2
Another example is the Phoca Gallery component which if you go into components/com_phocagallery/assets/jquery/jquery1.4.2.min.js it tells you right in the file name which version it uses .

All you need to do is look in the directory of the mod/temp/comp in question.

Also a note for VM2 newbies, to turn off jQuery please see picture below:

- Cleanshooter

nflmerch

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

dontflinch

I hate to be picky but for the sake of those who do not know - Javascript and Java are two totally different things.

these problems are Javascript conflicts, nothing to do with "Java"

nflmerch

Quote from: dontflinch on January 17, 2012, 19:57:54 PM
I hate to be picky but for the sake of those who do not know - Javascript and Java are two totally different things.

these problems are Javascript conflicts, nothing to do with "Java"
You're right, thanks for pointing that out.  I was making the dumb mistake of typing quick and shortening "javascript" without realizing  ;)

kyteasdale

Thanks for the info all - does anyone have a fix for this?  As much as I understand these things happen - especially through mixing free to use services.  But I'd love to have my customers on IE able to purchase too lol

Do you think here will be a fix for this with the J2.5 version of VM?

I was recommended this Plugin (http://tushev.org/products/jqueryintegrator), which on the surface looks to tick the boxes. However I am a JS/Jquery dummy! So if anyone has any luck with it feedback would rock!

Thanks all

PRO

Quote from: kyteasdale on January 25, 2012, 15:59:08 PM
Thanks for the info all - does anyone have a fix for this?  As much as I understand these things happen - especially through mixing free to use services.  But I'd love to have my customers on IE able to purchase too lol

Do you think here will be a fix for this with the J2.5 version of VM?

I was recommended this Plugin (http://tushev.org/products/jqueryintegrator), which on the surface looks to tick the boxes. However I am a JS/Jquery dummy! So if anyone has any luck with it feedback would rock!

Thanks all

there is not a single fix that helps everyone.

, post your url


PRO

Quote from: kyteasdale on January 25, 2012, 16:51:43 PM
prodanceportugal.com/eu thanks



  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
  <script src="http://cdn.jquerytools.org/1.2.5/all/jquery.tools.min.js" type="text/javascript"></script>
  <script src="/eu/components/com_virtuemart/assets/js/vmsite.js" type="text/javascript"></script>
  <script src="/eu/components/com_virtuemart/assets/js/facebox.js" type="text/javascript"></script>
  <script src="/eu/components/com_virtuemart/assets/js/vmprices.js" type="text/javascript"></script>
  <script src="/eu/plugins/system/jcemediabox/js/jcemediabox.js?version=111" type="text/javascript"></script>
  <script src="/eu/modules/mod_artnewsticker/js/jquery.js" type="text/javascript"></script>
  <script src="/eu/modules/mod_artnewsticker/js/jquery.nc.js" type="text/javascript"></script>
  <script src="/eu/modules/mod_artnewsticker/js/script.js" type="text/javascript"></script>


^^^ you have a few versions of jquery there.

You only need one, the latest versioned one.

kyteasdale

Thank you - is this more accurate

  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js" type="text/javascript"></script>
  <script src="/eu/plugins/system/jqueryintegrator/jqueryintegrator/jquery.noconflict.js" type="text/javascript"></script>
  <script src="/eu/media/system/js/core.js" type="text/javascript"></script>
  <script src="/eu/media/system/js/mootools-core.js" type="text/javascript"></script>
  <script src="/eu/media/system/js/caption.js" type="text/javascript"></script>
  <script src="/eu/plugins/system/jcemediabox/js/jcemediabox.js?version=111" type="text/javascript"></script>
  <script src="/eu/components/com_virtuemart/assets/js/vmsite.js" type="text/javascript"></script>
  <script src="/eu/components/com_virtuemart/assets/js/facebox.js" type="text/javascript"></script>
  <script src="/eu/components/com_virtuemart/assets/js/vmprices.js" type="text/javascript"></script>
  <script src="http://prodanceportugal.com/eu/modules/mod_artnewsticker/js/jquery.js" type="text/javascript"></script>
  <script src="http://prodanceportugal.com/eu/modules/mod_artnewsticker/js/jquery.nc.js" type="text/javascript"></script>
  <script src="http://prodanceportugal.com/eu/modules/mod_artnewsticker/js/script.js" type="text/javascript"></script>

PRO

then you also have 2 more down lower in the source

<script type="text/javascript">if ('undefined' != typeof jQuery) document._artxJQueryBackup = jQuery;</script>
<script type="text/javascript" src="/eu/templates/pdp_ocean/jquery.js"></script>
<script type="text/javascript">jQuery.noConflict();</script>
<script type="text/javascript" src="/eu/templates/pdp_ocean/script.js"></script>
<script type="text/javascript">if (document._artxJQueryBackup) jQuery = document._artxJQueryBackup;</script>