madalinoprea / magneto-varnish

Magento extension that implements full page caching using Varnish
http://moprea.ro/2011/may/6/magento-performance-optimization-varnish-cache-3/
123 stars 36 forks source link

Cache for compared items #5

Closed wbdv closed 13 years ago

wbdv commented 13 years ago

Cached page is show even If a product is added to compare. To fix that, you need to add a function in Helper/Cacheable.php like

public function hasCompareItems()
{
    $compare = Mage::helper('catalog/product_compare')->getItemCount();

    if($compare>0)
            return false;
    else
            return true;
}

then in Model/Observer.php change line 32 in

    if ($helper->quoteHasItems() || $helper->hasCompareItems()) {
dtremolo commented 13 years ago

Hello wbdv,

I tested your function on a completely fresh magento installation, and all I get it a white page (which might be because of nginx or magento), but that indicates that the code does not work. Im just guessing here, but could it be ' $compare = Mage::helper('catalog/product_compare')->getItemCount();' that does not work because it's a fresh installation?

madalinoprea commented 13 years ago

@wbdv, thanks for the patch, it was pushed to github. @dtremolo, try to update the repo and see if this time is working.

For all of you who we're using modman update the extension running: modman magneto-varnish update

dtremolo commented 13 years ago

Works like a charm.