svn commit: r1088035 - /ofbiz/branches/release10.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy

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

svn commit: r1088035 - /ofbiz/branches/release10.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy

jleroux@apache.org
Author: jleroux
Date: Sat Apr  2 14:19:44 2011
New Revision: 1088035

URL: http://svn.apache.org/viewvc?rev=1088035&view=rev
Log:
A patch from "Product page meta-tag does not contain i18n content" https://issues.apache.org/jira/browse/OFBIZ-4208

the groovy script that produces the content meta information is only partially using i18n information from the Content Wrapper. Namely, it does NOT use the Product or Category ContentWrapper to receive internationalized content for Product Name and Description or Category Description but rather the direct properties of the product entity.
Using the ContentWrapper will overcome this shortcoming.

The fix needs to be applied in applications/order/webapp/ordermgr/WEB-INF/actions/cart/catalog/Product.groovy

It is assumed that ContentWrappers will handle primitive over related Content properly, ie. if there is no related Content entity but only primitive content, it will return that. And if there is i18n content missing in the desired (current session) locale, it will return the default locale translation.

Modified:
    ofbiz/branches/release10.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy

Modified: ofbiz/branches/release10.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy
URL: http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy?rev=1088035&r1=1088034&r2=1088035&view=diff
==============================================================================
--- ofbiz/branches/release10.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy (original)
+++ ofbiz/branches/release10.04/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy Sat Apr  2 14:19:44 2011
@@ -81,13 +81,15 @@ if (productId) {
         context.put("metaDescription", contentWrapper.get("DESCRIPTION"));
 
         keywords = [];
-        keywords.add(product.productName);
+        keywords.add(contentWrapper.get("PRODUCT_NAME"));
         keywords.add(catalogName);
         members = delegator.findByAndCache("ProductCategoryMember", [productId : productId]);
         members.each { member ->
             category = member.getRelatedOneCache("ProductCategory");
-            if (category.description) {
-                keywords.add(category.description);
+            categoryContentWrapper = new CategoryContentWrapper(category, request);
+            categoryDescription = categoryContentWrapper.DESCRIPTION;
+            if (categoryDescription) {
+                keywords.add(categoryDescription);
             }
         }
         context.metaKeywords = StringUtil.join(keywords, ", ");