0

I created a module a few minutes ago to pull information from a RSS feed and display it in the admin panels notification inbox and toolbar that's right below the admin menu.

This works perfect, but unfortunately it doesn't load new messages when i refresh. I have to flush magento's cache and then refresh for it to load the new messages.

I would like to disable cache for the notifications module/block, so all new messages can be loaded each time the page is loaded.

i tired this line of code but it didnt seem to work:

<reference name="notification_toolbar">
<action method="setCacheLifetime"><s>0</s></action>
</reference>

I didnt expect this to work, since its not the one that generates the information, only displays it.

Can someone please advise me on how to disable the cache from this module/block.

thanks.

asked Aug 22, 2015 at 22:48

2 Answers 2

1

I figured it out by myself!

after looking through some codes i realize it has a update frequency timer, so i looked in the system section of the admin panel and found a update frequency selector under configuration => system => notification. Unfortunately the least time it had is 1 hour.

I went through the mage folders and found the following that provides the times.

Mage/Adminhtml/Model/System/Config/Source/Notification/Frequency.php

class Mage_Adminhtml_Model_System_Config_Source_Notification_Frequency
{
 public function toOptionArray()
 {
 return array(
 1 => Mage::helper('adminhtml')->__('1 Hour'),
 2 => Mage::helper('adminhtml')->__('2 Hours'),
 6 => Mage::helper('adminhtml')->__('6 Hours'),
 12 => Mage::helper('adminhtml')->__('12 Hours'),
 24 => Mage::helper('adminhtml')->__('24 Hours')
 );
 }
}

I then added the follow code and ran some tests, which worked!

0 => Mage::helper('adminhtml')->__('0 Minute'),

Not sure if i did it correctly, but it does exactly what i need it to. i then override this with my module to complete it.

Hope it helps others!

answered Aug 23, 2015 at 2:13
0

why do you want this to update so common, wouldn't it bloat your inbox?

There might be 2 options for you, you could write an event observer that clears this cache. admin_notifications_lastcheck is the cache tag i could find about the notifications.

The other option is to make the cache lifetime really short by writing a rewrite of the setLastUpdate function in core/AdminNotification/model/feed.php You can give this function a parameter with a cache lifetime.

I didn't try it and i'm in a hurry but since there are no answers i thought i should share it. I can add more info tomorrow if you require it.

answered Aug 23, 2015 at 0:40
2
  • thanks for the feedback, but i found a solution by myself. see my answer. not sure if what i typed makes sense but that what i did and it works. Commented Aug 23, 2015 at 1:59
  • 1
    regarding you question why... i modified it to provide me with notification from external sources and i don't want to wait 1hr for it to update. Commented Aug 23, 2015 at 2:21

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.