How to disable top notifications in the Prestashop back office

If your back office is hanging without apparent reason, it might be because of these notifications. Let’s get rid of them.

Watch the Screencast

Text version

Open up classes/Notification.php, and locate the getLastElements method:

	public function getLastElements()
	{
		global $cookie;

		$notifications = array();

		$employee_infos = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
		SELECT id_last_order, id_last_customer_message, id_last_customer
		FROM `'._DB_PREFIX_.'employee`
		WHERE `id_employee` = '.(int)$cookie->id_employee);

		foreach ($this->types as $type)
			$notifications[$type] = Notification::getLastElementsIdsByType($type, $employee_infos['id_last_'.$type]);

		return $notifications;
	}

Modify as follows

	public function getLastElements()
	{
		global $cookie;

		$notifications = array();

		foreach($this->types as $type)
			$notifications[$type] = array();

		return $notifications;

		$employee_infos = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
		SELECT id_last_order, id_last_customer_message, id_last_customer
		FROM `'._DB_PREFIX_.'employee`
		WHERE `id_employee` = '.(int)$cookie->id_employee);

		foreach ($this->types as $type)
			$notifications[$type] = Notification::getLastElementsIdsByType($type, $employee_infos['id_last_'.$type]);

		return $notifications;
	}

This way, we are effectively saving lots of resources as we don’t query the database for new items.

You like the tuts and want to say "thank you"? Well, you can always feel free to donate:

You like the tuts and want to say "thank you"? Well, you can always feel free to donate: