This site has been archived and you can no longer log in or post new messages. For up-to-date community resources please visit

eZ Community » Forums » Developer » [SOLVED] Filters fail on cached content

[SOLVED] Filters fail on cached content

[SOLVED] Filters fail on cached content

Thursday 18 December 2014 11:21:27 pm - 3 replies

Hi again,I have a page that makes use of cache to display a large set of fetched objects from a specific parent node. In the same page there is a form that allows to filter the objects through the submitted parameters retrieved from the url. The action of the form recall this same page. But the cache doesn't let the content to refresh.Without cache the page is loaded with very low performance. On the other hand it is stack and the filters don't take place. Any suggestion to help me think of a possible solution? Thanks blunk.gif Emoticon

P.S. Working on ez publish legacy stack

Modified on Friday 19 December 2014 11:47:38 pm by Lo' F.

Friday 19 December 2014 3:25:13 am

Hello Lo' F,

No worries, your use case has been well provided for happy.gif Emoticon

What you need to do is use template code to do the following:

  • Disable cache for this template
  • Use cache blocks to cache the contents of the template (your fetch, results display, etc)
  • Use cache block keys to use view parameters array as keys

The above will provide you with a solution which is both cached (faster) and flexible (allows for parameter based cacheing (to cache your fetch, results, etc).

If your having problems turning form parameters into view parameters take a look at the bcposttoview solution which can do this for you (and it's simple to customize if your needs are more specific).

I hope this helps!


Friday 19 December 2014 11:45:33 pm

Thank U, Heath!

You've opened a whole cache-block world to me, which is now waaaaay more clear! I just though it was meant for static content, but now, oh man, the keys parameter is very handy!


On top of the override template I disabled the view caching for the page

{set-block scope=global variable=cache_ttl}0{/set-block}

then defined the array variable of the fetched objects inside the cache-block

{cache-block keys=$view_parameters}
    {def $projects = $projects_fetch}

Set the keys parameter with the $view_parameters array that comes from the form.

In here I reviewed my things and then set the action to

<form method="post" action="{'/content/action'|ezurl('no')}">

in place of $node.url_alias that instead I passed as a value to a form hidden input field

<input type="hidden" name="DestinationURL" value="{$node.url_alias}" />

This way after form submission the data where passed as /year/2010/code/0001 to the uri (like you said I could have been encountering this problem) and,well, sadly couldn't make the extension you suggested to work (..but I'll try again later - time is a killer sometimes!) so I just forced the brackets around the input name

<select name="({$identifier})" id="{$identifier}">


Well the result these few steps have given is what I was asking for!

Thank you and thank you again for opening my sight! blunk.gif Emoticon

Saturday 20 December 2014 5:14:11 am

Hello Lo' F,

Congratulations! I'm very pleased to have been able to helped open your eyes to a whole new world of possibilities and to be able to help you solve your problems happy.gif Emoticon

Thank you for making this thread as solved. Hint in the future you just need to use the green check box icon, you don't need to edit the thread title happy.gif Emoticon

Till next time, take it eZ happy.gif Emoticon



You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from