You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Swapnil M Mane (JIRA)" <ji...@apache.org> on 2017/09/21 12:03:02 UTC

[jira] [Commented] (OFBIZ-9727) User should be notified if product is already added in Compare List

    [ https://issues.apache.org/jira/browse/OFBIZ-9727?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16174633#comment-16174633 ] 

Swapnil M Mane commented on OFBIZ-9727:
---------------------------------------

Thank you [~anushi.gupta10] for your contribution. 

This patch looks good, we can do following improvements.

We can avoid the assignment of event message in 'eventMsg' string twice. Since the String objects are immutable.

Instead we can directly set it in _EVENT_MESSAGE_ request attribute like,


{code:java}
if (!alreadyInList) { 
    compareList.add(product);
    session.setAttribute("productCompareList", compareList);
    request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage("ProductUiLabels", "ProductAddToCompareListSuccess", UtilMisc.toMap("name", productName), UtilHttp.getLocale(request)));
} else {
    request.setAttribute("_EVENT_MESSAGE_", UtilProperties.getMessage("ProductUiLabels", "ProductAlreadyInCompareList", UtilMisc.toMap("name", productName), UtilHttp.getLocale(request)));
}
{code}



> User should be notified if product is already added in Compare List
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-9727
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9727
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ecommerce
>    Affects Versions: Release Branch 16.11
>            Reporter: Anushi Gupta
>            Assignee: Anushi Gupta
>         Attachments: OFBIZ-9727.patch
>
>
> Steps to regenerate:
> 1. Go to Ecommerce component.
> 2. Add any product to compare list.
> 3. User is notified with success message as the product is added to compare list.
> 4. Try to add the same product to compare list.
> 5. Product does not get added twice but the success message is displayed again.
> Expected : User should be notified that product is already added to compare list.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)