News:

Support the VirtueMart project and become a member

Main Menu

Cart is not refreshed when clicking HOME or CART only on categories

Started by PostHistorie.nl, April 29, 2016, 15:48:05 PM

Previous topic - Next topic

PostHistorie.nl

Our site http://topicalcovers.com/ is running on Vmart 3.0.16 & Joomla 3.5.1 & PHP 5.4.45-0 and using Joomla Art Purity II (T3 Framework).

All caching and JS minifying/compressing (from T3 framework and Joomla) has been disabled!

Here is what happens:
When buying/adding an item to the basket -> the cart gets updated (popup) -> go to the cart (Show cart)-> item is not there! -> hard refresh the page-> the item is there.
Same thing happens when you add an item -> the cart gets updated (popup)->click the home button (menu) -> the cart is not updated

But it doesn't happen when you click one on the categories -> the cart is displayed correctly on the right!

I can see that when clicking the HOME button in the menu there are no hits in the apache access log, so the site is served from local cache (which would explain this): but all caching is disabled and I need the user to really refresh the page so how can I force this hard reload/refresh on every click?!

This also happens with the Beez2, Beez3 and Beez5 templates. So it doesn't seem to be a template issue (hence posted in General Questions).

It seems the 2 views associated with the HOME button and Cart are option=com_virtuemart&view=virtuemart and option=com_virtuemart&view=cart. Is the problem maybe there?

franzpeter

How are your settings in Virtuemart administration. Can you check there in configuration->Templates if that is activated:
Using the product Scripts. If it is not activated, activate it.

PostHistorie.nl

Yes it is activated! I've change around with several of these options, because Im not entirely sure what they do, and tried.

But either way, no difference...

franzpeter

I did check again to show the used resources. There are two possible things, which may conflict with the cart function: there are two core.js scripts. One is JA T3v2 System Plugin for J3.x. Maybe that produces the conflict. There is another one, which could influence the cart module: jarightcol.js. I do not know what that does, but I suppose it can influence  a module (like the VM cart module), because it implements an additional Javascript. VM cart already uses a script for the cart module function. Does JA template offers a module position, where non of those additional scripts take place?

PostHistorie.nl

Hi franzpeter, I really appreciate your help.
But I'm afraid it is not the js scripts, because other (non-T3) templates have the same issue (I switch templates and hard refresh). core.js is a T3 script and ja.rightcol.js is the joomla art module collapsing script.

It has to do with virtuemart not (hard) refreshing when certain views are used: com_virtuemart&view=category seems OK but com_virtuemart&view=virtuemart and com_virtuemart&view=cart are a problem and I don't understand why.

PostHistorie.nl

I'm trying to debug it a bit more and thus far I see this error in the Inspector console when clicking on the cart:

index.php?option=com_virtuemart&view=cart:404
Uncaught TypeError: jQuery(...).vm2front is not a function
(anonymous function) @ index.php?option=com_virtuemart&view=cart:404
j @ jquery.min.js:2
k.fireWith @ jquery.min.js:2
m.extend.ready @ jquery.min.js:2
J @ jquery.min.js:2

I am not a Javascript expert, but this seems wrong: any maybe part of my problem?

Also I have tried several  different setting under Configuration-> Templates -> Activate Css Styles & Javascripts
Use Fancybox (Recommended)   
Using the VirtueMart CSS   
Using the VirtueMart jQuery   
Using the product Scripts   
Using the Script ajax Countries / Regions   
Use jQuery chosen for dropdowns in FE   
Use ajax for product content   
Use external google jQuery library   

I tried all kinds of combinations but no luck...

PostHistorie.nl

So in a desperate move I checked ALL the boxes under Configuration-> Templates -> Activate Css Styles & Javascripts and low and behold: the cart seems to be functioning properly (and no more Inspector console errors). I can't really explain it. Because it's counterintuitive I would think: checking both "Using the VirtueMart jQuery" and "Use external google jQuery library" together that seems like a conflict....so I don't understand it, but this part works for now.

What's left is that clicking the HOME button doesn't properly update the cart. Any clues are welcome!

Funtshirts

Well...i know what you said about caching..
But i had the exact same problem, and with me it was the plugin system-pagecache it was set to on. When i turned it off everything was fixed.

What you also can try is the plugin Jqueryeasy it can solve jquery conflicts.

PostHistorie.nl

Hi Funtshirts, I looked at this plugin also but this was already turned off. I also have used the jquery easy plugin to fix things.

And I thought I had figured it out in my previous post, but I didn't, the problem came back after 2 or more items in the basket. So for future reference or anyone else reading this: I started a completely new installation of virtuemart and copied all my ~7000 items (some manual database work in phpmyadmin) to it and modified the Protostar template to fit my needs. Everything now works as it should.

I have wasted a lot of time on the JA Purity II and III template.