Reminder: Change Magento`s default phone numbers and callouts before site launch

来源:互联网 发布:edu是顶级域名? 编辑:程序博客网 时间:2024/04/30 17:44

Ok, finally fixed it.

This is a Magento bug, both with the notification rss feeds, and the logic behind checking whether Magento already has downloaded them or not. You can check the feeds manually here:http://notifications.magentocommerce.com/community/notifications.rss - and you’ll notice most of them have xml tags, in particular the ‘link’ tag. However, the annoying reminder “Reminder: Change Magento`s default phone numbers and callouts before site launch” does not have a link value, which is the problem.

When a feed is updated in the database, table ‘adminnotification_inbox’, the columns ‘is_read’, ‘is_remove’ and ‘url’ are updated. In the annoying message case, the ‘url’ column is updated with NULL (or left as empty if the message has not been touched). The code iterates through all feed items, and looks in the database if it has an item already based on it’s url. If the url matches it will not be inserted into the database. However, in this case, the url is NULL so the code fails and the same notification is inserted into the table.

The solution is simple:
1. Copy the file app/code/core/Mage/AdminNotification/Model/Resource/Inbox.php to app/code/local/Mage/AdminNotification/Model/Resource
2. Modify line 102, from:

$select $adapter->select()
                ->
from($this->getMainTable())
                ->
where('url=?'$item['url']);

to

$select $adapter->select()
                ->
from($this->getMainTable())
                ->
where('url=? OR url IS NULL'$item['url'])
                ->
where('title=?'$item['title']);
3. Delete all your notifications.

That’s it. Leave the admin for a little and log back in. You’ll see the notice has not come back.

Regards,
Michael.