You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Nop's front-end can display bar notifications that automatically disappear after a specified number of milliseconds (for example, /Plugins/Nop.Plugin.Tax.Avalara/Views/Customer/ExemptionCertificates.cshtml )
Nop's back-end can display bar notifications, but they must all be explicitly closed by the user by clicking the close [X] button, potentially interrupting their flow through the site.
Nop uses the NotificationService to create messages to pass to the front-end, and some of the notifications are strictly informational, especially when they are of the form:
_notificationService.SuccessNotification(...)
I have created and tested a modification of the methods in the NotificationService class that add a new optional timeout parameter. This allows back-end services to request that messages be displayed for a specified period of time, and then fade away automatically (using the already existing logic in the displayBarNotification javascript), requiring no user interaction.
It is a better user experience for the user to have messages like this disappear on their own, especially considering that they can actually see their product review on the page that the bar notification appears on.
The other methods would be called in an identical way:
nopCommerce version: 4.70
Description of the issue:
Nop's front-end can display bar notifications that automatically disappear after a specified number of milliseconds (for example, /Plugins/Nop.Plugin.Tax.Avalara/Views/Customer/ExemptionCertificates.cshtml )
Nop's back-end can display bar notifications, but they must all be explicitly closed by the user by clicking the close [X] button, potentially interrupting their flow through the site.
Nop uses the NotificationService to create messages to pass to the front-end, and some of the notifications are strictly informational, especially when they are of the form:
_notificationService.SuccessNotification(...)
I have created and tested a modification of the methods in the NotificationService class that add a new optional timeout parameter. This allows back-end services to request that messages be displayed for a specified period of time, and then fade away automatically (using the already existing logic in the displayBarNotification javascript), requiring no user interaction.
The new signatures are:
void SuccessNotification(string message, bool encode = true, int timeout = 0);
void WarningNotification(string message, bool encode = true, int timeout = 0);
void ErrorNotification(string message, bool encode = true, int timeout = 0);
Requesting that the message fade away without user interaction is as easy as adding the extra parameter.
For example, when a user posts a product review, this is the code that runs today:
_notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Reviews.SuccessfullyAdded"));
Allowing it to fade away with the extra parameter:
_notificationService.SuccessNotification(await _localizationService.GetResourceAsync("Reviews.SuccessfullyAdded"), timeout: 3000);
It is a better user experience for the user to have messages like this disappear on their own, especially considering that they can actually see their product review on the page that the bar notification appears on.
The other methods would be called in an identical way:
_notificationService.WarningNotification(message, timeout: 3000);
_notificationService.ErrorNotification(message, timeout: 3000);
If the extra parameter is not added, nothing changes. So, this would not be a breaking change.
Implementation also required small changes to the NotifyData.cs, Shared_Notifications.cshtml and Shared\Notifications.cshtml views.
Can I go ahead and polish this up for inclusion?
The text was updated successfully, but these errors were encountered: