Author: jleroux
Date: Sat Oct 29 18:04:48 2011
New Revision: 1194958
URL: http://svn.apache.org/viewvc?rev=1194958&view=rev
Log:
A patch from Carsten Schinzer https://issues.apache.org/jira/browse/OFBIZ-4208
"Product page meta-tag does not contain i18n content"
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.
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/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy
Modified:
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy?rev=1194958&r1=1194957&r2=1194958&view=diff
==============================================================================
---
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy
(original)
+++
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy
Sat Oct 29 18:04:48 2011
@@ -40,21 +40,6 @@ pageTitle = null;
metaDescription = null;
metaKeywords = null;
-/*
- * NOTE JLR 20070221 this should be done using the same method than in add to
cart. I will do it like that and remove all this after.
- *
-if (productId) {
- previousParams = session.getAttribute("_PREVIOUS_PARAMS_");
- if (previousParams) {
- previousParams =
UtilHttp.stripNamedParamsFromQueryString(previousParams, ["product_id"]);
- previousParams += "&product_id=" + productId;
- } else {
- previousParams = "product_id=" + productId;
- }
- session.setAttribute("_PREVIOUS_PARAMS_", previousParams); // for login
- context.previousParams = previousParams;
-}*/
-
// get the product entity
if (productId) {
product = delegator.findByPrimaryKeyCache("Product", [productId :
productId]);
@@ -122,15 +107,18 @@ if (productId) {
context.metaKeywords = metaKeywords.textData;
} else {
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, ", ");
}