shopping cart widget not to be cached by "W3 Total Cache"

Hi there,
I am using marketpress with w3 Total Cache now and it dramatically improved speed.
The only flaw is -when the pages are getting cached, that the shopping cart widget doesn't get updated.
in ...wp-admin/admin.php?page=w3tc_faq#q89
gives the hint to do "fragmented caching by adding to the .php-code:

How do I implement fragment caching?
Edit your templates to with the following syntax to ensure that dynamic features remain so:
Example 1:
<!-- mfunc any PHP code --><!-- /mfunc -->
Example 2:
<!-- mfunc -->any PHP code<!-- /mfunc -->
Example 3:
<!--MFUNC -->
echo rand();
<!--/mfunc -->
Example 4:
<!-- mclude path/to/file.php --><!-- /mclude -->
Example 5:
<!-- mclude -->path/to/file.php<!-- /mclude -->

How do I do this for marketpress shoppingcart widget?
In marketpress.php lines 5911.... ???? and how?

  • DavidM

    Hi thorsten119,

    Good question, and just to mention to start with, there's a slight bit of discussion on that in the following thread, with Aaron mentioning that full page caching will likely be an issue.
    https://premium.wpmudev.org/forums/topic/marketpress-and-wp-super-cache

    Not sure if W3C Total Cache provides a cookie based feature like that mentioned there, but I imagine that might work much better than having to alter plugin code, as that could get quite complicated. There's more than just the cart widget to consider, there's also the Add to Cart buttons and possibly a few other items.

    It does seem like you could add the <!-- mfunc --> tag to line 5910, then the closing <!-- /mfunc --> tag to line 5971. I'm not totally sure that would do it.

    The thing is, any updates to MarketPress would overwrite that change, thus a cookie detection method would be optimal if it's available.

    You could also try wrapping all of marketpress-includes/template-functions.php with the mfunc tags, as that's where the cart code is.
    <!-- mfunc --><!-- /mfunc -->

    Just to mention too, there's a slight bit of discussion on using that cache plugin with wp-ecommerce at the following on stackexchange:
    http://wordpress.stackexchange.com/questions/4845/wp-e-commerce-and-w3-total-cache-integration-problem

    -David

  • thorsten119

    Hi Aaron,

    well I prayed humbly....

    and I very much hoped there would have been be a realistic work-around.
    Maybe think it over, twist it a little bit again :wink:

    The point:
    The cart-widget is on literaly every page.
    If I except the mp_globalcart cookie in "w3 total cache", again, no page would be cached-> no speed-advantage at all ;-((

    I do see two solutions right now:
    1. Not to show the (dynamic)shopping-cart at all, but just a blunt link to the then non-cached Cart-Page (second-choice!)
    2. To still get a workaround to just not cache the shopping-cart-sidebar-widget only as Frederic Townes mentioned by using mfunc ; but how?...

    There must be a way. Maybe just get in contact with Frederic of "W3 Total Cache".

    As a (rational) argument:
    I simply could not work with a second-hand, slow e-commerce solution...
    and I trusted on wordpress, wpmu and marketpress promises to do this.
    ..and I believe you can do the best.

  • Aaron

    Page caching is only useful for non personalized users, such a visitors to a post and such. Once they have a cart cookie, full page caching is exactly what you want off. And i'm pretty sure that plugin in that case would revert to other php caching which is still good but works with dynamic content. Skipping by cookie is the ideal solution.

    And remember it's not just the widget, you have product listings, buy buttons, cart pages, etc which all will not work with full page caching.

  • Aaron

    Note it is for these very reasons large sites or those with dynamic frontend content (wordpress.com, edublogs.org, etc.) do not use full page caching. It's only really useful for cases where the majority of visitors don't require personlization. I'm pretty sure W3 Total Cache (if it's like super cache) already turns off page caching if they've ever logged in or left a comment (cookie checks). Adding the cart cookie to those checks is the same thing.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.