Filter Blocks based on Cookie value
Permalink
Anyone know if it is possible to filter out blocks based on a Cookie value, I have a request from a client, to have a disclaimer where the user would select what kind of customer they were (trade or Retail), based on the value, we would like to filter out any relevant blocks.
I'm thinking the blocks would have an attribute as to which whether they are trade, retail or both.
And also, we might just apply this to certain editable areas.
Any ideas?
Thanks
I'm thinking the blocks would have an attribute as to which whether they are trade, retail or both.
And also, we might just apply this to certain editable areas.
Any ideas?
Thanks
Thanks for the reply 12345J
Thinking about it as there are sometimes a mix of articles, so having them separated might not work too well.
I was hoping to do this at a php/cms level, but might have to look at a javascript solution if it is not possible.
Thinking about it as there are sometimes a mix of articles, so having them separated might not work too well.
I was hoping to do this at a php/cms level, but might have to look at a javascript solution if it is not possible.
Good Morning :)
That would allow for different areas to be split up which is handy if you want whole areas to be displayed or hidden depending on the cookie status.
To display different articles/pages in a page list you could then apply that same logic to the page list,
It would look something like this
Does that make sense?
Regards
-Sean
That would allow for different areas to be split up which is handy if you want whole areas to be displayed or hidden depending on the cookie status.
To display different articles/pages in a page list you could then apply that same logic to the page list,
It would look something like this
//this should probably be set in the controller within on_view? $userPurchaserType = $_COOKIE['userPurchaserType']; $p = new Permissions($page); foreach ($pages as $page): //assuming its only going to be one option $pageType = $page->getAttribute('pageType'); //check to see if the User is the allowed to view the page. //otherwise don't show the pages //assuming the cookie value is the same as the page attribute if ($pageType==$userPurchaserType || $pageType == "" || $p->canWrite()) { //display relevant articles //if the user is not set this will only display pages that do not have an attribute } endforeach;
Does that make sense?
Regards
-Sean
Thanks Sean, we'll give it a go
if you can edit the page you see both areas, and if your a user you'll only see blocks in the trade or the retail areas. make sense?