cancel
Showing results for 
Search instead for 
Did you mean: 

Refresh user newsletter subscription status

SOLVED

Re: Refresh user newsletter subscription status

cache lifetime false means cache for ever, null means no cache, but

1, set null does not actually work in layout xml, it will pass null as string 'null'

2, cache life time is set false in footer block, thus cached forever, so you will have to rewrite footer block class and change cache life time to NULL. But this has negative effect on performance(footer cache will be gone), so the best way IMO is to modify page template, split footer into 2 blocks, one for regular footer block(has cache lifetime false by default), another for subscriber block(has cache lifetime null by default).

Re: Refresh user newsletter subscription status

actually <action method="setCacheLifetime></action> will set the target block cache time null

Re: Refresh user newsletter subscription status

@KuafuSoft

 

Thanks for your input. But where/how do I rewrite footer block class? I think I could just change the footer to not cache, since there is nothing else in the footer but the subscribe block (and a contact us link), so performance probably wouldn't be impacted that much?

Re: Refresh user newsletter subscription status

then simply add this to default of your newsletter.xml

<reference name="footer"><action method="setCacheLifetime"></action></reference>

Re: Refresh user newsletter subscription status

Oh my, you are the man once again!

 

I had the

 

<action method="setCacheLifetime"></action>

 

line in the

 

<block type="newsletter/subscribe" name="footer.newsletter" as="newsletter" before="footer_store_language" template="newsletter/subscribe.phtml"></block>

 

block and it didn't work, but when I moved out to the default node per your input, it worked. And I don't notice a speed deterioration.

 

Thanks Kuafusoft, this is great, I really appreciate your help!!

Re: Refresh user newsletter subscription status

In the same block xml I gave you, you could possibly try unsetting the cache keys as well as setting the cache life time to null:

 

<action method="unsetData"><key>cache_tags</key></action>

Use the same snippet I gave you that fixed the action tag and add this one underneath that one. If this doesn't work, you might want to hire someone to look into your code. You could try something like rent a coder or a similar site for that. These are proven methods to stop cache blocking on single blocks. You could even try setting the cache lifetime to 1, but there is still the chance someone gets that cached block, which probably wouldn't be a good thing.