0

Is it possible to set a start/end date for Static Blocks or Widgets somehow?

Or is this only possible with Banners?

I know it would be possible to do this using CMS layout for specific pages or categories, but I am planning on doing a sitewide implementation of a static block/widget and was wondering if there is a possibility to give these a specfic date when they show up/stop showing up.

So basically I would like to create a static block and show Date from Date1 to Date2 and after that date hide it again.

2

It's not possible out of the box.

When you're creating a custom widget you could add 2 date fields and use those in the _toHtml() method to either show or suppress output which would probably be the easiest solution.

For static blocks etc you would need to add date from and to columns to the database extending the blocks that display these elements to check for the date being valid.

It would involve quite a lot of rewriting so probably only use it if you really have to

  • static block is the entity where Magento uses least number of specific event dispatches. You are absolutely right on the "rewrite" statement. It deserves a +1 – Rajeev K Tomy Mar 26 '15 at 16:10
  • I had this on my screen before and wasn´t sure if thats the easiest but it seems like its not that difficult to do it that way so I will give it a try. Thanks a lot – Klettseb Mar 26 '15 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.