svn commit: r1849538 - in /ofbiz/ofbiz-framework/trunk/applications/product: config/ProductUiLabels.xml src/main/java/org/apache/ofbiz/product/product/ProductEvents.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1849538 - in /ofbiz/ofbiz-framework/trunk/applications/product: config/ProductUiLabels.xml src/main/java/org/apache/ofbiz/product/product/ProductEvents.java

akashjain
Author: akashjain
Date: Sat Dec 22 10:57:37 2018
New Revision: 1849538

URL: http://svn.apache.org/viewvc?rev=1849538&view=rev
Log:
Improved: User should be notified if product is already added in the compare list.
(OFBIZ-9727)
Thanks, Anushi Gupta for your contribution.

Modified:
    ofbiz/ofbiz-framework/trunk/applications/product/config/ProductUiLabels.xml
    ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java

Modified: ofbiz/ofbiz-framework/trunk/applications/product/config/ProductUiLabels.xml
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/config/ProductUiLabels.xml?rev=1849538&r1=1849537&r2=1849538&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/config/ProductUiLabels.xml (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/config/ProductUiLabels.xml Sat Dec 22 10:57:37 2018
@@ -13165,6 +13165,9 @@
         <value xml:lang="zh">轮流的关键字字典</value>
         <value xml:lang="zh-TW">輪流的關鍵字字典</value>
     </property>
+    <property key="ProductAlreadyInCompareList">
+        <value xml:lang="en">Product ${name} already exist in compare list</value>
+    </property>
     <property key="ProductAmount">
         <value xml:lang="de">Betrag</value>
         <value xml:lang="en">Amount</value>

Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java?rev=1849538&r1=1849537&r2=1849538&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/product/ProductEvents.java Sat Dec 22 10:57:37 2018
@@ -1091,13 +1091,14 @@ public class ProductEvents {
                 break;
             }
         }
+        String productName = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", request, "string");
         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)));
         }
-        session.setAttribute("productCompareList", compareList);
-        String productName = ProductContentWrapper.getProductContentAsText(product, "PRODUCT_NAME", request, "html");
-        String eventMsg = UtilProperties.getMessage("ProductUiLabels", "ProductAddToCompareListSuccess", UtilMisc.toMap("name", productName), UtilHttp.getLocale(request));
-        request.setAttribute("_EVENT_MESSAGE_", eventMsg);
         return "success";
     }