nexcess / magento-turpentine

A Varnish extension for Magento.
GNU General Public License v2.0
520 stars 252 forks source link

Compare, Compared and remove info message - ALL CACHED! #716

Closed addison74 closed 9 years ago

addison74 commented 9 years ago

It is so easy to check what is cached or not. Just use Back/Forward buttons in your browser to get the magic. Well I found side blocks Product Compare and Product Compared are both cached. I checked if there are ESI rules for them and again like for Community Poll, there are rules set up. You can add products to comparison, go visiting other page add one more. Go back to initial added product, block Compare shows one product instead of two products.

After you comparef and removed products you will see Recently Compared Products block appearing. This is completely compromised too showing wrong number of products or compared products.

And finally one more thing "I like" is related to message box. After you remove a product from comparison you will get this message inside a green box: "The product XXXXXX has been removed from comparison list." Go visit another product and go back. Message is still there.

This extension is very useful but painful using as it is now. Really folks if you cannot deal with Magento stock why providing it? Why a release without basic checking? I was beta tester for a lot of shopping carts, some of them very popular. I dedicated my time to improve this extension. But when I see there is no response from the development team I regret a lot spending my time in digging it for issues.

anderow commented 9 years ago

Interesting discovery, nice one. You have made a lot of input into this extension from my extensive reading I have done on this group. I can't find anything from the dev team either. I have an ongoing issue with this extension and Varnish 4 but cant get any assistance to sort it. I realise V4 is not supported but I think it should be seeing as turpentine allegedly supports Magento 1.9.1

addison74 commented 9 years ago

Community Poll has an interesting issue I don't understand. It is astonishing nobody from Nexcess did not finding yet. It is related to all versions of Magento starting with 1.7.

Using comparison is compromised because side blocks Compare Products and Recently Compared Products are both cached. Also the message information when you remove a product from compare in side block is cached.

I understand there are problems with Varnish 4, it is not supported yet. But let's find a way all together to give a good shape to this extension and release it working for Magento default. Then if someone wants more related to custom blocks or extensions to have a good tutorial to solve himself the issues.

Really guys, Magento needs Varnish. It is a slow shopping cart. Without Turpentine you will have a lazy store and not far from the other carts. Nexcess policy is wrong if only money count. Shining your company name means your products are mass distributed and becoming "must have" in all Magento shopping carts. I am here to help and I hope to find more and more interested to give a good shape to this extension.

gewaechshaus commented 9 years ago

I noticed a related issue with an individual block and the turpentine_esi.xml. As long as i reference the block in turpentine_esi.xml, esi won't ever work. This doesn't happen on every block, but seems to appear to some as in my individual case, or to some native blocks like welcome. If i setup the my esi related stuff in the extensions layout.xml, esi is rendered like it should. I think the problem is related to the magento core and some of the rendering html methods.

gewaechshaus commented 9 years ago

Recently viewed items block is also a candidate. Doesn't seem to work with the default turpentine_esi setup, will try the same workaround as with my individual block tomorow.

addison74 commented 9 years ago

Cache Storage Management section in Admin has the following cache types:

Configuration Layouts Blocks HTML output Translations Collections Data EAV types and attributes Web Services Configuration Web Services Configuration Varnish Pages Varnish ESI Blocks

In my case all are Enabled. I tried to disable a few of them in different scenarios and no luck to get positive behavior. I thought Configuration, Layouts and Block HTML output could have some influence over Varnish but I found nothing changing. I can leave the store as it is now, but over a while I have to disable these features (Comparing) if I don't find a solution to caching.

If Nexcess abandoned this project I suggest placing a note from them instead of letting us just reporting issues.

gewaechshaus commented 9 years ago

I did some tests, maybe you can do some more testing.

Putting the following piece of code into turpentine_esi results in the block never seems to be holepunched:

  <reference name="right.reports.product.viewed">
        <action method="setEsiOptions">
            <params>
                <access>private</access>
                <flush_events>
                    <catalog_controller_product_view/>
                </flush_events>
            </params>
        </action>
    </reference>

Putting the following piece into local.xml, ESI is working as is should:

<reference name="right">
        <block type="reports/product_viewed" before="right.permanent.callout" name="right.reports.product.viewed" template="reports/product_viewed.phtml" >
          <action method="setEsiOptions">
              <params>
                  <access>private</access>
                  <method>esi</method>
              </params>
          </action>
        </block>
  </reference>

So this seems to be a problem related to some layout xml and structures...

Finaly, if somebody stumbles upon:

  <remove name="right.reports.product.viewed" />
  <remove name="left.reports.product.viewed" />
     <reference name="right">
                   <block type="reports/product_viewed" name="right.reports.product.viewed.turpentine" template="reports/product_viewed.phtml">
                        <!-- doesnt work in turpentine_esi.xml!!! -->
                       <action method="setEsiOptions">
                           <params>
                               <access>private</access>
                               <method>esi</method>
                                <flush_events>
                                    <catalog_controller_product_view/>
                               </flush_events>
                           </params>
                       </action>
                   </block>
           </reference>
addison74 commented 9 years ago

Recently Viewed Products right side block is cached too. I will follow your advice. Maybe we can solve the mystery related to other side blocks like Recently Compared Products, Community Poll and info message after we remove a product from compare list (Compare side block).

gewaechshaus commented 9 years ago

Yes... I hope so ;)

Recently Viewed Products right side block is cached too. I will follow your advice. Maybe we can solve the mystery related to other side blocks like Recently Compared Products, Community Poll and info message after we remove a product from compare list (Compare side block).

— Reply to this email directly or view it on GitHub https://github.com/nexcess/magento-turpentine/issues/716#issuecomment-69398409.

addison74 commented 9 years ago

@gewaechshaus related to your solution for Recently Viewed Products side block. Delete your browser cache, cookies, magento sessions and cache.

Visit your Home Page then visit one of you categories:

Now you have 4 tabs: Category, Product 1, Product 2, product 3.

Let's visit Category 2 page. Recently Viewed Products side block shows 3 products (it is normal). But if you visit a new product, this category will show you 3 products.

You solution it is not working with categories and first product visited after a category. Just check and come back to me. Anyway you improved a lot in a good direction the code.

addison74 commented 9 years ago

I installed a Magento 1.8 stock without Turpentine. I followed all my steps from above.

1) If you refresh category page it won't show Recently Viewed Products right side block.

2) But if you visit all those 3 product pages and refresh them, you will get Recently Viewed Products side block SHOWING THE OTHER 2 PRODUCTS but NOT THE ONE YOU REFRESHED!

Let's say we visited 4 products in 4 tabs. If we refresh all 4 pages we will get 3 products in Recently Viewed Products side block, the missing product link is the current page.

Using Turpentine the show begins with wrong results: the very first product visited will not load Recently Viewed Product side block even we refresh many times the page. This is not good, something is still wrong there with its ESI cache rule.

gewaechshaus commented 9 years ago

I have to recheck this, which isn't as easy cause we are in a productional environment... I will pm you the URL to do some tests. Maybe some of the turpentine methods are corrupted, this need a deep inspection.

As the pm systems seems to be disabled since 2012, here's the URL http://www.haustierkost.de

After some quick testing, this seems to happen in our case 2. We'll have to look into the esi observer as a good starting point... Another thing which would be interessting to test, what happens if we define the block as esi via ajax (which isn't a test rather than a solution), or with a zero ttl (0)

From the main documentation

For blocks, the extension listens for the core_block_abstract_to_html_before event in Magento. When this event is triggered, the extension looks at the block attached to it and if an ESI policy has been defined for the block then the block's template is replaced with a simple ESI (or AJAX) template that tells Varnish to pull the block content from a separate URL. Varnish then does another request to that URL to get the content for that block, which can be cached separately from the page and may differ between different visitors/clients.

Related observer methods https://github.com/nexcess/magento-turpentine/blob/master/app/code/community/Nexcessnet/Turpentine/Model/Observer/Esi.php#L191

Important comment https://github.com/nexcess/magento-turpentine/blob/master/app/code/community/Nexcessnet/Turpentine/Model/Observer/Esi.php#L342

Related controller https://github.com/nexcess/magento-turpentine/blob/master/app/code/community/Nexcessnet/Turpentine/controllers/EsiController.php#L1

addison74 commented 9 years ago

First category you visit, won't show Recently Viewed Products, even you refresh the page. Then first product you visit after the category won't show Recently Viewed Products too. If you continue visiting products and refreshing pages everything goes normal.

This side block has an proved issue.

gewaechshaus commented 9 years ago

After some quick logging, it seems that the block won't pass the check in most cases, turpentine seems to inject the block only in a very few cases

TURPENTINE: Checking ESI block candidate: right.reports.product.viewed.turpentine

vs

TURPENTINE: Checking ESI block candidate: right.reports.product.viewed.turpentine
TURPENTINE: Block check passed, injecting block: right.reports.product.viewed.turpentine

The method _getBlockLayoutHandles should get rewritten from the scratch as it is checking every block instead of getting only the blocks that should be injected. It would make sense to build this list from a select menu in BE which allows to set flags like 'ajax' 'ttl' and so on.

addison74 commented 9 years ago

This is really bad. What a shame to have an unfinished extension for Magento ...

By the way, why Nexcess is not telling us this extension is not supported anymore? It will help all a lot such of message.

aricwatson commented 9 years ago

Closing this issue in favor of your more recent issue https://github.com/nexcess/magento-turpentine/issues/803