Author Topic: Joomla 1.5 System Cache and VM cart caching  (Read 56533 times)

cvoogt

  • Jr. Member
  • **
  • Posts: 50
    • Plethora Design
Joomla 1.5 System Cache and VM cart caching
« on: July 25, 2008, 19:39:13 pm »
I am running Joomla 1.5.4 with VM 1.1, in native mode (no legacy).
In my global configuration I have caching turned ON, gzip compression turned ON, and in my plugins I have the "System - Cache" plugin turned OFF (disabled).

When I turn the System Cache plugin on, it of course caches the pages on my site, but it is also caching the VM cart module. This is strange, because I thought the cache from the global config is what actually cached modules. I have tested it extensively with various combinations of settings, and I can do nothing but conclude that I have to have page caching (i.e. the "System - Cache" plugin) disabled in order to have the cart showing the correct information to the shopper.

Here is an example of what happens to a shopper when the system cache is turned on:

Shopper enters home page, and the cart shows empty (correct).
Shopper browses to product category pages and adds a couple products. They show up in their cart in the VM cart module (correct).
Customer goes back to home page (using same URL as before), but cart shows empty.

Or, if the customer at first adds just one product, then goes to home, it will correctly show the one product in their cart module. If they then go and add a second product and then return to the home page using the same URL (i.e. http://www.yourdomain.com), it will still only show the one product there ... UNLESS I have the system cache turned off.

I really need the system cache to speed up my site.

Does anyone have advice on this? The VM cart module does not have an option to exclude it from caching, like many modules do, and it does appear to be adversely affected by the Joomla system cache.

I have as I said tested this with the global config's cache off and page caching on, and the problem still happened. Turn system cache off, and the problem disappears. Turning gzip compression on or off made no difference either ... only turning page caching off in the plugins area is what fixed it.

Thanks,
Casper

benm

  • Beginner
  • *
  • Posts: 2
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #1 on: August 25, 2008, 11:39:59 am »
Hi Casper,

I had this exact same problem and I put in a small hack to get around this:

In the file /plugins/system/cache.php

Change line 60:

Code: [Select]
if (!$user->get('aid') && $_SERVER['REQUEST_METHOD'] == 'GET') {
to

Code: [Select]
if (!$user->get('aid') && !$_SESSION['cart']['idx'] && $_SERVER['REQUEST_METHOD'] == 'GET') {
I'm basically just telling the cache plugin to not display the cached page if the customer has anything in the cart!

Let me know if it works.

-Ben

trendsettingdesign

  • Jr. Member
  • **
  • Posts: 59
    • The Captain's Coffee
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #2 on: September 01, 2008, 16:31:37 pm »
Side note: make sure you upgrade to Joomla! 1.5.6 immediately, if not sooner.  Lots of Joomla sites have been hacked of late, and the 1.5.6 upgrade addresses security vulnerabilities.  It'd be terrible if you got the cache working properly, then lost your site to some loser hacker!
Joomla! 1.5.6
VirtueMart 1.1.2
PHP 5

kiper

  • Beginner
  • *
  • Posts: 25
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #3 on: November 30, 2008, 23:31:05 pm »
Thanks Ben, that really helped me out. I am wrestling with a webshop that has some heavy traffic right now that consists of Joomla, Virtuemart and JoomFish among other things and the caching proved neccessary unless I want to bring the webserver down...

krinolin

  • Beginner
  • *
  • Posts: 4
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #4 on: August 26, 2009, 01:44:02 am »
This solution saved my life!!!
Thanks!

jm3d

  • Beginner
  • *
  • Posts: 2
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #5 on: August 27, 2009, 07:56:09 am »
It's refreshing to find a good answer on this forum! Thank you for the new code.
-john

dj_hardbeat

  • Beginner
  • *
  • Posts: 24
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #6 on: September 16, 2009, 17:10:27 pm »
Hi all!

I'm using VM 1.1.3 and Joomla 1.5.14 and was wondering if this solution is still actual? Is this the only thing to do to speed up? Any other tips or tricks?

Thanks everybody!


Otto0815

  • Jr. Member
  • **
  • Posts: 189
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #7 on: October 15, 2009, 12:34:05 pm »
Yeaah...this seems to work.......using vm 1.1.3, joomla 1.5.14 legacy "on"

many many thanks!!!!!!

rbalji75

  • Beginner
  • *
  • Posts: 4
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #8 on: October 16, 2009, 08:45:39 am »
Awesome!!! thanks a lot

dsmarket

  • Beginner
  • *
  • Posts: 5
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #9 on: June 29, 2010, 04:11:26 am »
Thanks. It is work with virtuemart 1.1.4 too.
www.dsmarket.rs

QubeSys Technologies

  • Jr. Member
  • **
  • Posts: 288
  • Joomla & Magento Services
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #10 on: September 02, 2010, 23:54:07 pm »
Hi..
Do I need to keep the System Cache plugin active for this ?
Blissful!

bulesz

  • Jr. Member
  • **
  • Posts: 194
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #11 on: September 07, 2010, 04:10:55 am »
Thanks benm, its really working! :) I have put this code to the JOTcache so now it can use with VM.. ;)

Zehana: yes, turn on the plugin, but make the hack first....

QubeSys Technologies

  • Jr. Member
  • **
  • Posts: 288
  • Joomla & Magento Services
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #12 on: September 07, 2010, 04:41:04 am »
Did it.

It works for me now.
But client says, it doesnt work for him.
No idea, whats going on..
Blissful!

vishwa

  • Beginner
  • *
  • Posts: 2
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #13 on: October 05, 2010, 17:34:45 pm »
hi ben
your code is working for me thanks.

In the file /plugins/system/cache.php

Change line 60:

Code:
if (!$user->get('aid') && $_SERVER['REQUEST_METHOD'] == 'GET') {

to

Code:
if (!$user->get('aid') && !$_SESSION['cart']['idx'] && $_SERVER['REQUEST_METHOD'] == 'GET') {


_fD_

  • Jr. Member
  • **
  • Posts: 118
    • Printdesign :: Joomla! CMS Webdesign :: Apple Computer Support
Re: Joomla 1.5 System Cache and VM cart caching
« Reply #14 on: January 05, 2011, 11:51:12 am »
Hi Ben

i tested it a little bit out and found following bug:

If i deleted the content of the basket and then press back to shop the modul basket shows still a product in the overview. Of coz, if i go to the basket it is empty.

Do you have an idea to fix this too

Then i have a question, if it isnt possible to exclude the link from the basket intead the session, becoz so far i see is the basket session running, when i add products to the basket, only when i click the link to the basket it is empty. Do i add again a product to it, the basket is again filled...

Thank you for your replay.

With best regards,
Urs

VM 1.1.4
Joomla 1.5.22