Author: hansbak
Date: Tue Mar 8 09:35:20 2011 New Revision: 1079307 URL: http://svn.apache.org/viewvc?rev=1079307&view=rev Log: It is now possible to manually override the automatic generated page meta description, keywords and title in the content tab in product and category. Also ecommerce component has been adapted. A contribution of AntWebsystems employee Tom Added: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy (with props) ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy (with props) Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Product.groovy ofbiz/trunk/applications/product/config/ProductUiLabels.xml ofbiz/trunk/applications/product/data/ProductTypeData.xml ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductContentServices.xml ofbiz/trunk/applications/product/servicedef/services.xml ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml ofbiz/trunk/applications/product/widget/catalog/CategoryScreens.xml ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml Modified: ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml (original) +++ ofbiz/trunk/applications/order/script/org/ofbiz/order/olap/FactServices.xml Tue Mar 8 09:35:20 2011 @@ -152,7 +152,20 @@ under the License. <result-to-field result-name="dimensionId" field="fact.productDimId"/> </call-service> <if-empty field="fact.productDimId"> - <set field="fact.productDimId" value="_NF_"/> + <entity-one entity-name="Product" value-field="productDim"> + <field-map field-name="productId" from-field="orderItem.productId"/> + </entity-one> + <make-value entity-name="ProductDimension" value-field="newEntity"/> + <sequenced-id sequence-name="ProductDimension" field="newEntity.dimensionId"/> + <set field="newEntity.productId" from-field="productDim.productId"/> + <set field="newEntity.productType" from-field="productDim.productTypeId"/> + <set field="newEntity.brandName" from-field="productDim.brandName"/> + <set field="newEntity.internalName" from-field="productDim.internalName"/> + <create-value value-field="newEntity"/> + <set field="fact.productDimId" from-field="newEntity.dimensionId"/> + <if-empty field="fact.productDimId"> + <set field="fact.productDimId" value="_NF_"/> + </if-empty> </if-empty> <else> <set field="fact.productDimId" value="_NA_"/> @@ -176,9 +189,8 @@ under the License. </if-not-empty> <!-- productCategoryId --> - <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers"> + <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers" filter-by-date="true"> <field-map field-name="productId" from-field="orderItem.productId"/> - <field-map field-name="thruDate" from-field="nullField"/> </entity-and> <if-not-empty field="productCategoryMembers"> <first-from-list list="productCategoryMembers" entry="productCategoryMember"/> @@ -495,11 +507,10 @@ under the License. <first-from-list entry="UomConversion" list="UomConversionDatedList"/> <field-to-result field="UomConversion.conversionFactor" result-name="conversionFactor"/> <else> - <entity-condition entity-name="UomConversionDated" list="UomConversionDatedLastestList"> + <entity-condition entity-name="UomConversionDated" list="UomConversionDatedLastestList" filter-by-date="true"> <condition-list combine="and"> <condition-expr field-name="uomId" operator="equals" from-field="parameters.uomId"/> <condition-expr field-name="uomIdTo" operator="equals" from-field="parameters.uomIdTo"/> - <condition-expr field-name="thruDate" operator="equals" from-field="nullField"/> </condition-list> </entity-condition> <if-not-empty field="UomConversionDatedLastestList"> Modified: ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy (original) +++ ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/entry/catalog/Category.groovy Tue Mar 8 09:35:20 2011 @@ -34,6 +34,10 @@ catalogName = CatalogWorker.getCatalogNa productCategoryId = request.getAttribute("productCategoryId") ?: parameters.category_id; context.productCategoryId = productCategoryId; +pageTitle = null; +metaDescription = null; +metaKeywords = null; + /* NOTE DEJ20070220: this is a weird way to do this and caused unacceptable side effects as described in the related * comment in the Main.groovy file * @@ -58,14 +62,44 @@ if (category) { if (category.detailScreen) { detailScreen = category.detailScreen; } + categoryPageTitle = delegator.findByAndCache("ProductCategoryContentAndInfo", [productCategoryId : productCategoryId, prodCatContentTypeId : "PAGE_TITLE"]); + if (categoryPageTitle) { + pageTitle = delegator.findByPrimaryKeyCache("ElectronicText", [dataResourceId : categoryPageTitle.get(0).dataResourceId]); + } + categoryMetaDescription = delegator.findByAndCache("ProductCategoryContentAndInfo", [productCategoryId : productCategoryId, prodCatContentTypeId : "META_DESCRIPTION"]); + if (categoryMetaDescription) { + metaDescription = delegator.findByPrimaryKeyCache("ElectronicText", [dataResourceId : categoryMetaDescription.get(0).dataResourceId]); + } + categoryMetaKeywords = delegator.findByAndCache("ProductCategoryContentAndInfo", [productCategoryId : productCategoryId, prodCatContentTypeId : "META_KEYWORD"]); + if (categoryMetaKeywords) { + metaKeywords = delegator.findByPrimaryKeyCache("ElectronicText", [dataResourceId : categoryMetaKeywords.get(0).dataResourceId]); + } categoryContentWrapper = new CategoryContentWrapper(category, request); - context.title = categoryContentWrapper.CATEGORY_NAME; + categoryDescription = categoryContentWrapper.DESCRIPTION; - if (categoryDescription) { - context.metaDescription = categoryDescription; - context.metaKeywords = categoryDescription + ", " + catalogName; + + if (pageTitle) { + context.title = pageTitle.textData; + } else { + context.title = categoryContentWrapper.CATEGORY_NAME; + } + + if (metaDescription) { + context.metaDescription = metaDescription.textData; + } else { + if (categoryDescription) { + context.metaDescription = categoryDescription; + } + } + + if (metaKeywords) { + context.metaKeywords = metaKeywords.textData; } else { - context.metaKeywords = catalogName; + if (categoryDescription) { + context.metaKeywords = categoryDescription + ", " + catalogName; + } else { + context.metaKeywords = catalogName; + } } context.productCategory = category; } 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=1079307&r1=1079306&r2=1079307&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 Tue Mar 8 09:35:20 2011 @@ -36,6 +36,10 @@ requestParams = UtilHttp.getParameterMap detailScreen = "productdetail"; productId = requestParams.product_id ?: request.getAttribute("product_id"); +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. * @@ -72,6 +76,19 @@ if (productId) { product = delegator.findByPrimaryKeyCache("Product", [productId : productId]); } + productPageTitle = delegator.findByAndCache("ProductContentAndInfo", [productId : productId, productContentTypeId : "PAGE_TITLE"]); + if (productPageTitle) { + pageTitle = delegator.findByPrimaryKeyCache("ElectronicText", [dataResourceId : productPageTitle.get(0).dataResourceId]); + } + productMetaDescription = delegator.findByAndCache("ProductContentAndInfo", [productId : productId, productContentTypeId : "META_DESCRIPTION"]); + if (productMetaDescription) { + metaDescription = delegator.findByPrimaryKeyCache("ElectronicText", [dataResourceId : productMetaDescription.get(0).dataResourceId]); + } + productMetaKeywords = delegator.findByAndCache("ProductContentAndInfo", [productId : productId, productContentTypeId : "META_KEYWORD"]); + if (productMetaKeywords) { + metaKeywords = delegator.findByPrimaryKeyCache("ElectronicText", [dataResourceId : productMetaKeywords.get(0).dataResourceId]); + } + context.productId = productId; // now check to see if there is a view allow category and if this product is in it... @@ -88,20 +105,34 @@ if (productId) { if (product) { context.product = product; contentWrapper = new ProductContentWrapper(product, request); - context.put("title", contentWrapper.get("PRODUCT_NAME")); - context.put("metaDescription", contentWrapper.get("DESCRIPTION")); - keywords = []; - keywords.add(product.productName); - keywords.add(catalogName); - members = delegator.findByAndCache("ProductCategoryMember", [productId : productId]); - members.each { member -> - category = member.getRelatedOneCache("ProductCategory"); - if (category.description) { - keywords.add(category.description); + if (pageTitle) { + context.title = pageTitle.textData; + } else { + context.put("title", contentWrapper.get("PRODUCT_NAME")); + } + + if (metaDescription) { + context.metaDescription = metaDescription.textData; + } else { + context.put("metaDescription", contentWrapper.get("DESCRIPTION")); + } + + if (metaKeywords) { + context.metaKeywords = metaKeywords.textData; + } else { + keywords = []; + keywords.add(product.productName); + keywords.add(catalogName); + members = delegator.findByAndCache("ProductCategoryMember", [productId : productId]); + members.each { member -> + category = member.getRelatedOneCache("ProductCategory"); + if (category.description) { + keywords.add(category.description); + } } + context.metaKeywords = StringUtil.join(keywords, ", "); } - context.metaKeywords = StringUtil.join(keywords, ", "); // Set the default template for aggregated product (product component configurator ui) if (product.productTypeId && "AGGREGATED".equals(product.productTypeId) && context.configproductdetailScreen) { Modified: ofbiz/trunk/applications/product/config/ProductUiLabels.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/config/ProductUiLabels.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/config/ProductUiLabels.xml (original) +++ ofbiz/trunk/applications/product/config/ProductUiLabels.xml Tue Mar 8 09:35:20 2011 @@ -5832,7 +5832,17 @@ <property key="Manage"> <value xml:lang="en">Manage</value> <value xml:lang="th">à¸à¸±à¸à¸à¸²à¸£</value> - </property> <property key="PageTitleAddFacilityGroupRollup"> + </property> + <property key="MetaDescription"> + <value xml:lang="en">Meta Description</value> + </property> + <property key="MetaKeywords"> + <value xml:lang="en">Meta Keywords</value> + </property> + <property key="PageTitle"> + <value xml:lang="en">Page Title</value> + </property> + <property key="PageTitleAddFacilityGroupRollup"> <value xml:lang="de">Einrichtungsgruppe Rollup hinzufügen</value> <value xml:lang="en">Add Facility Group Rollup</value> <value xml:lang="es">Añadir despliegue de grupo de almacenes</value> Modified: ofbiz/trunk/applications/product/data/ProductTypeData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/data/ProductTypeData.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/data/ProductTypeData.xml (original) +++ ofbiz/trunk/applications/product/data/ProductTypeData.xml Tue Mar 8 09:35:20 2011 @@ -227,6 +227,9 @@ under the License. <ProductCategoryContentType description="Link 1 Alt Text" hasTable="N" parentTypeId="" prodCatContentTypeId="LINK1_ALT_TEXT"/> <ProductCategoryContentType description="Link 2 Alt Text" hasTable="N" parentTypeId="" prodCatContentTypeId="LINK2_ALT_TEXT"/> <ProductCategoryContentType description="Footer" hasTable="N" parentTypeId="" prodCatContentTypeId="FOOTER"/> + <ProductCategoryContentType description="Page Title" hasTable="N" parentTypeId="" prodCatContentTypeId="PAGE_TITLE"/> + <ProductCategoryContentType description="Meta Keyword" hasTable="N" parentTypeId="" prodCatContentTypeId="META_KEYWORD"/> + <ProductCategoryContentType description="Meta Description" hasTable="N" parentTypeId="" prodCatContentTypeId="META_DESCRIPTION"/> <ProductContentType description="Online Access" hasTable="N" parentTypeId="" productContentTypeId="ONLINE_ACCESS"/> <ProductContentType description="Digital Download" hasTable="N" parentTypeId="" productContentTypeId="DIGITAL_DOWNLOAD"/> @@ -279,6 +282,9 @@ under the License. <ProductContentType description="Installation" hasTable="N" parentTypeId="DIGITAL_DOWNLOAD" productContentTypeId="INSTALLATION"/> <ProductContentType description="Specification" hasTable="N" parentTypeId="DIGITAL_DOWNLOAD" productContentTypeId="SPECIFICATION"/> <ProductContentType description="Warranty" hasTable="N" parentTypeId="DIGITAL_DOWNLOAD" productContentTypeId="WARRANTY"/> + <ProductContentType description="Page Title" hasTable="N" parentTypeId="" productContentTypeId="PAGE_TITLE"/> + <ProductContentType description="Meta Keyword" hasTable="N" parentTypeId="" productContentTypeId="META_KEYWORD"/> + <ProductContentType description="Meta Description" hasTable="N" parentTypeId="" productContentTypeId="META_DESCRIPTION"/> <ProdConfItemContentType description="Image" hasTable="N" parentTypeId="" confItemContentTypeId="IMAGE_URL"/> <ProdConfItemContentType description="Description" hasTable="N" parentTypeId="" confItemContentTypeId="DESCRIPTION"/> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryContentServices.xml Tue Mar 8 09:35:20 2011 @@ -70,4 +70,72 @@ under the License. <set-service-fields service-name="updateSimpleTextContent" map="parameters" to-map="updateSimpleText"/> <call-service service-name="updateSimpleTextContent" in-map-name="updateSimpleText"/> </simple-method> + <simple-method method-name="updateContentSEOForCategory" short-description="Update Category SEO"> + <if-not-empty field="parameters.title"> + <entity-and list="productCategoryContents" entity-name="ProductCategoryContentAndInfo"> + <field-map field-name="productCategoryId" from-field="parameters.productCategoryId"/> + <field-map field-name="prodCatContentTypeId" value="PAGE_TITLE"/> + </entity-and> + <if-not-empty field="productCategoryContents"> + <first-from-list entry="productCategoryContent" list="productCategoryContents"/> + <entity-one value-field="electronicText" entity-name="ElectronicText"> + <field-map field-name="dataResourceId" from-field="productCategoryContent.dataResourceId"/> + </entity-one> + <if-not-empty field="electronicText"> + <set field="electronicText.textData" from-field="parameters.title"/> + <store-value value-field="electronicText"/> + </if-not-empty> + <else> + <set field="createTextContentMap.productCategoryId" from-field="parameters.productCategoryId"/> + <set field="createTextContentMap.prodCatContentTypeId" value="PAGE_TITLE"/> + <set field="createTextContentMap.text" from-field="parameters.title"/> + <call-service service-name="createSimpleTextContentForCategory" in-map-name="createTextContentMap"/> + </else> + </if-not-empty> + </if-not-empty> + <if-not-empty field="parameters.metaKeyword"> + <entity-and list="productCategoryContents" entity-name="ProductCategoryContentAndInfo"> + <field-map field-name="productCategoryId" from-field="parameters.productCategoryId"/> + <field-map field-name="prodCatContentTypeId" value="META_KEYWORD"/> + </entity-and> + <if-not-empty field="productCategoryContents"> + <first-from-list entry="productCategoryContent" list="productCategoryContents"/> + <entity-one value-field="electronicText" entity-name="ElectronicText"> + <field-map field-name="dataResourceId" from-field="productCategoryContent.dataResourceId"/> + </entity-one> + <if-not-empty field="electronicText"> + <set field="electronicText.textData" from-field="parameters.metaKeyword"/> + <store-value value-field="electronicText"/> + </if-not-empty> + <else> + <set field="createTextContentMap.productCategoryId" from-field="parameters.productCategoryId"/> + <set field="createTextContentMap.prodCatContentTypeId" value="META_KEYWORD"/> + <set field="createTextContentMap.text" from-field="parameters.metaKeyword"/> + <call-service service-name="createSimpleTextContentForCategory" in-map-name="createTextContentMap"/> + </else> + </if-not-empty> + </if-not-empty> + <if-not-empty field="parameters.metaDescription"> + <entity-and list="productCategoryContents" entity-name="ProductCategoryContentAndInfo"> + <field-map field-name="productCategoryId" from-field="parameters.productCategoryId"/> + <field-map field-name="prodCatContentTypeId" value="META_DESCRIPTION"/> + </entity-and> + <if-not-empty field="productCategoryContents"> + <first-from-list entry="productCategoryContent" list="productCategoryContents"/> + <entity-one value-field="electronicText" entity-name="ElectronicText"> + <field-map field-name="dataResourceId" from-field="productCategoryContent.dataResourceId"/> + </entity-one> + <if-not-empty field="electronicText"> + <set field="electronicText.textData" from-field="parameters.metaDescription"/> + <store-value value-field="electronicText"/> + </if-not-empty> + <else> + <set field="createTextContentMap.productCategoryId" from-field="parameters.productCategoryId"/> + <set field="createTextContentMap.prodCatContentTypeId" value="META_DESCRIPTION"/> + <set field="createTextContentMap.text" from-field="parameters.metaDescription"/> + <call-service service-name="createSimpleTextContentForCategory" in-map-name="createTextContentMap"/> + </else> + </if-not-empty> + </if-not-empty> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/category/CategoryServices.xml Tue Mar 8 09:35:20 2011 @@ -899,9 +899,8 @@ under the License. </else> </if-compare> - <entity-and entity-name="ProductStoreCatalog" list="productStoreCatalogs"> + <entity-and entity-name="ProductStoreCatalog" list="productStoreCatalogs" filter-by-date="true"> <field-map field-name="productStoreId" from-field="parameters.productStoreId"/> - <field-map field-name="thruDate" from-field="nullField"/> </entity-and> <if-not-empty field="productStoreCatalogs"> <first-from-list list="productStoreCatalogs" entry="productStoreCatalog"/> @@ -973,9 +972,8 @@ under the License. <simple-method method-name="FindBestSellingProduct" short-description="Find best selling product."> <now-timestamp field="nowTimestamp"/> - <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers"> + <entity-and entity-name="ProductCategoryMember" list="productCategoryMembers" filter-by-date="true"> <field-map field-name="productCategoryId" from-field="parameters.productCategoryId"/> - <field-map field-name="thruDate" from-field="nullField"/> </entity-and> <iterate list="productCategoryMembers" entry="productCategoryMember"> <entity-condition entity-name="SalesOrderItemStarSchema" list="salesOrderItemStarSchemas" distinct="true"> Modified: ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductContentServices.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductContentServices.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductContentServices.xml (original) +++ ofbiz/trunk/applications/product/script/org/ofbiz/product/product/ProductContentServices.xml Tue Mar 8 09:35:20 2011 @@ -202,4 +202,74 @@ under the License. </if-empty> <store-value value-field="lookedUpValue"/> </simple-method> + + <!-- Product Content SEO --> + <simple-method method-name="updateContentSEOForProduct" short-description="Update Product SEO"> + <if-not-empty field="parameters.title"> + <entity-and list="productContents" entity-name="ProductContentAndInfo"> + <field-map field-name="productId" from-field="parameters.productId"/> + <field-map field-name="productContentTypeId" value="PAGE_TITLE"/> + </entity-and> + <if-not-empty field="productContents"> + <first-from-list entry="productContent" list="productContents"/> + <entity-one value-field="electronicText" entity-name="ElectronicText"> + <field-map field-name="dataResourceId" from-field="productContent.dataResourceId"/> + </entity-one> + <if-not-empty field="electronicText"> + <set field="electronicText.textData" from-field="parameters.title"/> + <store-value value-field="electronicText"/> + </if-not-empty> + <else> + <set field="createTextContentMap.productId" from-field="parameters.productId"/> + <set field="createTextContentMap.productContentTypeId" value="PAGE_TITLE"/> + <set field="createTextContentMap.text" from-field="parameters.title"/> + <call-service service-name="createSimpleTextContentForProduct" in-map-name="createTextContentMap"/> + </else> + </if-not-empty> + </if-not-empty> + <if-not-empty field="parameters.metaKeyword"> + <entity-and list="productContents" entity-name="ProductContentAndInfo"> + <field-map field-name="productId" from-field="parameters.productId"/> + <field-map field-name="productContentTypeId" value="META_KEYWORD"/> + </entity-and> + <if-not-empty field="productContents"> + <first-from-list entry="productContent" list="productContents"/> + <entity-one value-field="electronicText" entity-name="ElectronicText"> + <field-map field-name="dataResourceId" from-field="productContent.dataResourceId"/> + </entity-one> + <if-not-empty field="electronicText"> + <set field="electronicText.textData" from-field="parameters.metaKeyword"/> + <store-value value-field="electronicText"/> + </if-not-empty> + <else> + <set field="createTextContentMap.productId" from-field="parameters.productId"/> + <set field="createTextContentMap.productContentTypeId" value="META_KEYWORD"/> + <set field="createTextContentMap.text" from-field="parameters.metaKeyword"/> + <call-service service-name="createSimpleTextContentForProduct" in-map-name="createTextContentMap"/> + </else> + </if-not-empty> + </if-not-empty> + <if-not-empty field="parameters.metaDescription"> + <entity-and list="productContents" entity-name="ProductContentAndInfo"> + <field-map field-name="productId" from-field="parameters.productId"/> + <field-map field-name="productContentTypeId" value="META_DESCRIPTION"/> + </entity-and> + <if-not-empty field="productContents"> + <first-from-list entry="productContent" list="productContents"/> + <entity-one value-field="electronicText" entity-name="ElectronicText"> + <field-map field-name="dataResourceId" from-field="productContent.dataResourceId"/> + </entity-one> + <if-not-empty field="electronicText"> + <set field="electronicText.textData" from-field="parameters.metaDescription"/> + <store-value value-field="electronicText"/> + </if-not-empty> + <else> + <set field="createTextContentMap.productId" from-field="parameters.productId"/> + <set field="createTextContentMap.productContentTypeId" value="META_DESCRIPTION"/> + <set field="createTextContentMap.text" from-field="parameters.metaDescription"/> + <call-service service-name="createSimpleTextContentForProduct" in-map-name="createTextContentMap"/> + </else> + </if-not-empty> + </if-not-empty> + </simple-method> </simple-methods> Modified: ofbiz/trunk/applications/product/servicedef/services.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/servicedef/services.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/servicedef/services.xml (original) +++ ofbiz/trunk/applications/product/servicedef/services.xml Tue Mar 8 09:35:20 2011 @@ -451,7 +451,7 @@ under the License. <override name="productContentTypeId" optional="false"/> <override name="productId" optional="false"/> </service> - + <service name="uploadProductAdditionalViewImages" engine="simple" location="component://product/script/org/ofbiz/product/product/ProductContentServices.xml" invoke="uploadProductAdditionalViewImages" auth="true"> <description>Upload Additional View Images For Product</description> @@ -471,6 +471,15 @@ under the License. <attribute name="_additionalImageFour_contentType" type="String" mode="IN" optional="true"/> </service> + <service name="updateContentSEOForProduct" engine="simple" + location="component://product/script/org/ofbiz/product/product/ProductContentServices.xml" invoke="updateContentSEOForProduct" auth="true"> + <description>Update Product SEO</description> + <attribute name="productId" mode="IN" type="String" optional="false"/> + <attribute name="title" mode="IN" type="String" optional="true"/> + <attribute name="metaKeyword" mode="IN" type="String" optional="true"/> + <attribute name="metaDescription" mode="IN" type="String" optional="true"/> + </service> + <!-- SupplierProduct Services --> <service name="createSupplierProduct" default-entity-name="SupplierProduct" engine="simple" location="component://product/script/org/ofbiz/product/supplier/SupplierProductServices.xml" invoke="createSupplierProduct" auth="true"> @@ -961,6 +970,15 @@ under the License. <attribute name="text" type="String" mode="IN" optional="true" allow-html="safe"/> </service> + <service name="updateContentSEOForCategory" engine="simple" + location="component://product/script/org/ofbiz/product/category/CategoryContentServices.xml" invoke="updateContentSEOForCategory" auth="true"> + <description>Update Category SEO</description> + <attribute name="productCategoryId" mode="IN" type="String" optional="false"/> + <attribute name="title" mode="IN" type="String" optional="true"/> + <attribute name="metaKeyword" mode="IN" type="String" optional="true"/> + <attribute name="metaDescription" mode="IN" type="String" optional="true"/> + </service> + <!-- ProductFeatureDataResource services --> <service name="createProductFeatureDataResource" default-entity-name="ProductFeatureDataResource" engine="simple" location="component://product/script/org/ofbiz/product/product/ProductContentServices.xml" invoke="createProductFeatureDataResource" auth="true"> Added: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy?rev=1079307&view=auto ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy (added) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy Tue Mar 8 09:35:20 2011 @@ -0,0 +1,21 @@ +productCategoryId = parameters.productCategoryId; +if (productCategoryId) { + productCategoryContents = delegator.findByAnd("ProductCategoryContent", ["productCategoryId" : productCategoryId]); + productCategoryContents.each{ productCategoryContent-> + if (productCategoryContent.prodCatContentTypeId == "PAGE_TITLE") { + contentTitle = delegator.findOne("Content", ["contentId" : productCategoryContent.contentId], false); + dataTextTitle = delegator.findOne("ElectronicText", ["dataResourceId" : contentTitle.dataResourceId], false); + context.title = dataTextTitle.textData; + } + if (productCategoryContent.prodCatContentTypeId == "META_KEYWORD") { + contentMetaKeyword = delegator.findOne("Content", ["contentId" : productCategoryContent.contentId], false); + dataTextMetaKeyword = delegator.findOne("ElectronicText", ["dataResourceId" : contentMetaKeyword.dataResourceId], false); + context.metaKeyword = dataTextMetaKeyword.textData; + } + if (productCategoryContent.prodCatContentTypeId == "META_DESCRIPTION") { + contentMetaDescription = delegator.findOne("Content", ["contentId" : productCategoryContent.contentId], false); + dataTextMetaDescription = delegator.findOne("ElectronicText", ["dataResourceId" : contentMetaDescription.dataResourceId], false); + context.metaDescription = dataTextMetaDescription.textData; + } + } +} \ No newline at end of file Propchange: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy (original) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy Tue Mar 8 09:35:20 2011 @@ -140,6 +140,9 @@ if (productContentTypeId) { context.contentFormName = "EditProductContentDownload"; } } +if (("PAGE_TITLE".equals(productContentTypeId))||("META_KEYWORD".equals(productContentTypeId))||("META_DESCRIPTION".equals(productContentTypeId))) { + context.contentFormName = "EditProductContentSEO"; +} context.productContentData = productContentData; context.content = content; Added: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy?rev=1079307&view=auto ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy (added) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy Tue Mar 8 09:35:20 2011 @@ -0,0 +1,21 @@ +productId = parameters.productId; +if (productId) { + productContents = delegator.findByAnd("ProductContent", ["productId" : productId]); + productContents.each{ productContent-> + if (productContent.productContentTypeId == "PAGE_TITLE") { + contentTitle = delegator.findOne("Content", ["contentId" : productContent.contentId], false); + dataTextTitle = delegator.findOne("ElectronicText", ["dataResourceId" : contentTitle.dataResourceId], false); + context.title = dataTextTitle.textData; + } + if (productContent.productContentTypeId == "META_KEYWORD") { + contentMetaKeyword = delegator.findOne("Content", ["contentId" : productContent.contentId], false); + dataTextMetaKeyword = delegator.findOne("ElectronicText", ["dataResourceId" : contentMetaKeyword.dataResourceId], false); + context.metaKeyword = dataTextMetaKeyword.textData; + } + if (productContent.productContentTypeId == "META_DESCRIPTION") { + contentMetaDescription = delegator.findOne("Content", ["contentId" : productContent.contentId], false); + dataTextMetaDescription = delegator.findOne("ElectronicText", ["dataResourceId" : contentMetaDescription.dataResourceId], false); + context.metaDescription = dataTextMetaDescription.textData; + } + } +} \ No newline at end of file Propchange: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy ------------------------------------------------------------------------------ svn:mime-type = text/plain Modified: ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml (original) +++ ofbiz/trunk/applications/product/webapp/catalog/WEB-INF/controller.xml Tue Mar 8 09:35:20 2011 @@ -340,7 +340,7 @@ under the License. <response name="error" type="view" value="EditCategoryParties"/> </request-map> - <!-- ================ Category Content Requests ================= --> + <!-- ================ Category Content Requests ================= --> <request-map uri="EditCategoryContent"> <security https="true" auth="true"/> <response name="success" type="view" value="EditCategoryContent"/> @@ -352,7 +352,7 @@ under the License. <response name="error" type="view" value="EditCategoryContent"/> </request-map> - <!-- ================ Category Content Assoc Requests ================= --> + <!-- ================ Category Content Assoc Requests ================= --> <request-map uri="EditCategoryContentContent"> <security https="true" auth="true"/> <response name="success" type="view" value="EditCategoryContentContent"/> @@ -508,6 +508,7 @@ under the License. <response name="success" type="view" value="EditProductAssetUsage"/> <response name="error" type="view" value="EditProductAssetUsage"/> </request-map> + <!-- ================ Fixed Asset to Product Requests ================= --> <request-map uri="showFixedAssetProduct"> <security https="true" auth="true"/> @@ -561,8 +562,8 @@ under the License. <response name="success" type="request-redirect" value="EditProductPrices"><redirect-parameter name="productId"/></response> <response name="error" type="view" value="EditProductPrices"/> </request-map> - <!-- ================ Category Content Requests ================= --> + <!-- ================ Category Content Requests ================= --> <request-map uri="EditCategoryContent"> <security https="true" auth="true"/> <response name="success" type="view" value="EditCategoryContent"/> @@ -573,6 +574,7 @@ under the License. <response name="success" type="view" value="EditCategoryContent"/> <response name="error" type="view" value="EditCategoryContent"/> </request-map> + <!-- ================ Category Content Assoc Requests ================= --> <request-map uri="EditCategoryContentContent"> <security https="true" auth="true"/> @@ -612,6 +614,13 @@ under the License. <response name="success" type="view" value="EditCategoryContent"/> <response name="error" type="view" value="EditCategoryContentContent"/> </request-map> + <request-map uri="updateContentSEOForCategory"> + <security https="true" auth="true"/> + <event type="service" path="" invoke="updateContentSEOForCategory"/> + <response name="success" type="view" value="EditCategoryContent"/> + <response name="error" type="view" value="EditCategoryContentContent"/> + </request-map> + <!-- ================ Product Content Requests ================= --> <request-map uri="EditProductContent"> <security https="true" auth="true"/> @@ -627,6 +636,12 @@ under the License. <security https="true" auth="true"/> <response name="success" type="view" value="EditProductContent"/> </request-map> + <request-map uri="updateContentSEOForProduct"> + <security https="true" auth="true"/> + <event type="service" path="" invoke="updateContentSEOForProduct"/> + <response name="success" type="view" value="EditProductContent"/> + <response name="error" type="view" value="EditProductContentContent"/> + </request-map> <!-- ================ Product Content Assoc Requests ================= --> <request-map uri="EditProductContentContent"> Modified: ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/CategoryForms.xml Tue Mar 8 09:35:20 2011 @@ -254,4 +254,14 @@ under the License. <field name="categoryName" sort-field="true"><display/></field> <field name="description" sort-field="true"><display/></field> </form> + + <form name="EditCategoryContentSEO" type="single" target="updateContentSEOForCategory" title="${uiLabelMap.ProductUpdateSimpleTextContentCategory}" + header-row-style="header-row" default-table-style="basic-table"> + <field name="title" title="${uiLabelMap.PageTitle}"><text size="40"/></field> + <field name="metaKeyword" title="${uiLabelMap.MetaKeywords}"><textarea cols="60" rows="5"/></field> + <field name="metaDescription" title="${uiLabelMap.MetaDescription}"><textarea cols="60" rows="5"/></field> + <field name="productCategoryId"><hidden/></field> + <field name="prodCatContentTypeId"><hidden/></field> + <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field> + </form> </forms> Modified: ofbiz/trunk/applications/product/widget/catalog/CategoryScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/CategoryScreens.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/CategoryScreens.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/CategoryScreens.xml Tue Mar 8 09:35:20 2011 @@ -205,6 +205,8 @@ under the License. <set field="textDataMap.text" from-field="electronicText.textData"/> <set field="textDataMap.textDataResourceId" from-field="content.dataResourceId"/> <set field="contentId" from-field="content.contentId"/> + + <script location="component://product/webapp/catalog/WEB-INF/actions/category/EditCategorySEO.groovy"/> </actions> <widgets> <decorator-screen name="CommonCategoryDecorator"> @@ -218,7 +220,21 @@ under the License. </widgets> </section> <screenlet title="${uiLabelMap.ProductUpdateSimpleTextContentCategory}"> - <include-form name="EditCategoryContentSimpleText" location="component://product/widget/catalog/CategoryForms.xml"/> + <section> + <condition> + <or> + <if-compare operator="equals" value="PAGE_TITLE" field="parameters.prodCatContentTypeId"/> + <if-compare operator="equals" value="META_KEYWORD" field="parameters.prodCatContentTypeId"/> + <if-compare operator="equals" value="META_DESCRIPTION" field="parameters.prodCatContentTypeId"/> + </or> + </condition> + <widgets> + <include-form name="EditCategoryContentSEO" location="component://product/widget/catalog/CategoryForms.xml"/> + </widgets> + <fail-widgets> + <include-form name="EditCategoryContentSimpleText" location="component://product/widget/catalog/CategoryForms.xml"/> + </fail-widgets> + </section> </screenlet> <screenlet title="${uiLabelMap.ProductListAssociatedContentInfos}"> <include-form name="ListAssociatedContentInfos" location="component://product/widget/catalog/ProductForms.xml"/> Modified: ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/ProductForms.xml Tue Mar 8 09:35:20 2011 @@ -815,6 +815,16 @@ under the License. <field use-when="contentId != null" name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field> </form> + <form name="EditProductContentSEO" type="single" target="updateContentSEOForProduct" title="${uiLabelMap.PageTitleEditProductContent}" + header-row-style="header-row" default-table-style="basic-table"> + <field name="title" title="${uiLabelMap.PageTitle}"><text size="40"/></field> + <field name="metaKeyword" title="${uiLabelMap.MetaKeywords}"><textarea cols="60" rows="5"/></field> + <field name="metaDescription" title="${uiLabelMap.MetaDescription}"><textarea cols="60" rows="5"/></field> + <field name="productId"><hidden/></field> + <field name="productContentTypeId"><hidden/></field> + <field name="submitButton" title="${uiLabelMap.CommonUpdate}" widget-style="smallSubmit"><submit button-type="button"/></field> + </form> + <!-- SupplierProduct --> <form name="AddSupplierProduct" type="single" target="updateSupplierProduct" title="" default-map-name="supplierProduct" header-row-style="header-row" default-table-style="basic-table"> Modified: ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml?rev=1079307&r1=1079306&r2=1079307&view=diff ============================================================================== --- ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml (original) +++ ofbiz/trunk/applications/product/widget/catalog/ProductScreens.xml Tue Mar 8 09:35:20 2011 @@ -983,6 +983,7 @@ under the License. <entity-one entity-name="Product" value-field="product"/> <entity-one entity-name="ProductContent" value-field="productContent"/> <script location="component://product/webapp/catalog/WEB-INF/actions/product/EditProductContentContent.groovy"/> + <script location="component://product/webapp/catalog/WEB-INF/actions/product/EditProductSEO.groovy"/> </actions> <widgets> <decorator-screen name="CommonProductDecorator" location="${parameters.productDecoratorLocation}"> |
Free forum by Nabble | Edit this page |